diff --git a/apps/participation/migrations/0008_auto_20220429_1853.py b/apps/participation/migrations/0008_auto_20220429_1853.py new file mode 100644 index 0000000..c3974a3 --- /dev/null +++ b/apps/participation/migrations/0008_auto_20220429_1853.py @@ -0,0 +1,24 @@ +# Generated by Django 3.2.13 on 2022-04-29 16:53 + +from django.db import migrations, models +import participation.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('participation', '0007_remove_passage_place'), + ] + + operations = [ + migrations.AlterField( + model_name='solution', + name='file', + field=models.FileField(unique=True, upload_to=participation.models.get_solution_filename, verbose_name='file'), + ), + migrations.AlterField( + model_name='synthesis', + name='file', + field=models.FileField(unique=True, upload_to=participation.models.get_synthesis_filename, verbose_name='file'), + ), + ] diff --git a/apps/participation/models.py b/apps/participation/models.py index 91d0f5f..d032cba 100644 --- a/apps/participation/models.py +++ b/apps/participation/models.py @@ -547,8 +547,6 @@ class Solution(models.Model): verbose_name=_("file"), upload_to=get_solution_filename, unique=True, - blank=True, - default="", ) def __str__(self): @@ -588,8 +586,6 @@ class Synthesis(models.Model): verbose_name=_("file"), upload_to=get_synthesis_filename, unique=True, - blank=True, - default="", ) def __str__(self): diff --git a/apps/participation/views.py b/apps/participation/views.py index 1718aaa..b04e718 100644 --- a/apps/participation/views.py +++ b/apps/participation/views.py @@ -751,7 +751,7 @@ class PassageDetailView(LoginRequiredMixin, DetailView): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) if self.request.user.registration in self.object.pool.juries.all(): - context["my_note"] = Note.objects.get(passage=self.object, jury=self.request.user.registration) + context["my_note"] = Note.objects.get_or_create(passage=self.object, jury=self.request.user.registration)[0] context["notes"] = NoteTable([note for note in self.object.notes.all() if note]) elif self.request.user.registration.is_admin: context["notes"] = NoteTable([note for note in self.object.notes.all() if note])