plateforme-corres2math/apps/participation/signals.py

11 lines
385 B
Python
Raw Normal View History

2020-09-27 12:32:05 +00:00
from participation.models import Participation, Video
2020-09-24 08:21:50 +00:00
def create_team_participation(instance, **_):
2020-09-27 12:32:05 +00:00
participation = Participation.objects.get_or_create(team=instance)[0]
if not participation.solution:
participation.solution = Video.objects.create()
if not participation.synthesis:
participation.synthesis = Video.objects.create()
participation.save()