Project

General

Profile

Download (783 Bytes) Statistics
| Branch: | Tag: | Revision:

calebasse / scripts / copy_description.py @ 0d4bf0b4

1
# -*- coding: utf-8 -*-
2
#!/usr/bin/env python
3

    
4
import os
5

    
6
log = open('descriptions.log', 'a+')
7

    
8
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "calebasse.settings")
9

    
10
from calebasse.agenda.models import EventWithAct
11

    
12
for event in EventWithAct.objects.all():
13
    if event.act:
14
        if not event.act.comment and event.description:
15
            event.act.comment = event.description
16
            event.act.save()
17
        if event.act.comment and event.description \
18
           and (event.act.comment != event.description):
19
            log.write("acte : %s\n" % event.act.comment.encode('utf-8'))
20
            log.write("evenement (%d) : %s\n\n" % (event.id, event.description.encode('utf-8')))
21
            event.act.comment = event.description
22
            event.act.save()
23

    
24
log.close()
(8-8/47)