utils for participants

This commit is contained in:
Sanj 2011-12-13 18:01:47 +05:30
parent e494c25dd3
commit 0bd93b2cea
2 changed files with 20 additions and 0 deletions

0
itf/tmp/__init__.py Normal file
View File

20
itf/tmp/utils.py Normal file
View File

@ -0,0 +1,20 @@
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