it/itf/tmp/utils.py

31 lines
865 B
Python
Raw Normal View History

2011-12-13 12:31:47 +00:00
from festival.models import *
def clean_participants():
unique_participants = []
participants = Participant.objects.all()
for p in participants:
if not p.name in unique_participants:
unique_participants.append(p.name)
for u in unique_participants:
dupes = participants.filter(name=u)
to_keep = dupes[0]
meeting_ids = []
for d in dupes:
to_keep.meetings.add(d.meeting.id)
to_keep.save()
for d in dupes[1:]:
d.delete()
print u
def add_meeting_dates():
for m in Meeting.objects.all():
dates = MeetingDay.objects.filter(meeting=m)
if len(dates) > 0:
date = dates[0].meeting_date
if not m.created:
m.created = date
if not m.changed:
m.changed = date
m.save()
2011-12-13 12:31:47 +00:00