Revision 812a8635
Added by Jérôme Schneider about 11 years ago
scripts/copy_description.py | ||
---|---|---|
1 | 1 |
# -*- coding: utf-8 -*- |
2 | 2 |
#!/usr/bin/env python |
3 | 3 |
|
4 |
import calebasse.settings |
|
5 |
import django.core.management |
|
4 |
import os |
|
6 | 5 |
|
7 |
django.core.management.setup_environ(calebasse.settings) |
|
6 |
log = open('descriptions.log', 'a+') |
|
7 |
|
|
8 |
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "calebasse.settings") |
|
8 | 9 |
|
9 | 10 |
from calebasse.agenda.models import EventWithAct |
10 | 11 |
|
11 | 12 |
for event in EventWithAct.objects.all(): |
12 |
if not event.act.comment and event.description: |
|
13 |
event.act.comment = event.description |
|
14 |
event.act.save() |
|
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() |
Also available in: Unified diff
scripts/copy_description.py: synchronize event description to act comment
This script logged the old comments
Closes #4006