utils for participants
This commit is contained in:
parent
e494c25dd3
commit
0bd93b2cea
0
itf/tmp/__init__.py
Normal file
0
itf/tmp/__init__.py
Normal file
20
itf/tmp/utils.py
Normal file
20
itf/tmp/utils.py
Normal 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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user