From 83f5ee6aa75ba109b6e3de60ae942bd56391f04c Mon Sep 17 00:00:00 2001 From: kovacspe Date: Thu, 23 May 2024 21:07:52 +0200 Subject: [PATCH 1/3] Add __str__ method dor RegistrationLink --- competition/models.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/competition/models.py b/competition/models.py index c78d38f..9e30029 100644 --- a/competition/models.py +++ b/competition/models.py @@ -622,11 +622,11 @@ class Vote(models.IntegerChoices): POSITIVE = 1, 'pozitívny' -def get_solution_path(instance, filename): #pylint: disable=unused-argument +def get_solution_path(instance, filename): # pylint: disable=unused-argument return instance.get_solution_file_path() -def get_corrected_solution_path(instance, filename): #pylint: disable=unused-argument +def get_corrected_solution_path(instance, filename): # pylint: disable=unused-argument return instance.get_corrected_solution_file_path() @@ -798,6 +798,9 @@ def can_user_modify(self, user): # pylint: disable=no-member return self.event.can_user_modify(user) + def __str__(self): + return str(self.event) + class ProblemCorrection(models.Model): # TODO: Add images From eb28593b5dc9496ecd83103c7b788d2d04a3b47d Mon Sep 17 00:00:00 2001 From: kovacspe Date: Thu, 23 May 2024 22:01:35 +0200 Subject: [PATCH 2/3] Add location and competition type short name --- competition/fixtures/competition_types.json | 18 ++++++++++++------ competition/fixtures/events.json | 6 ++++-- competition/models.py | 4 ++++ 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/competition/fixtures/competition_types.json b/competition/fixtures/competition_types.json index 3284b46..703cb0a 100644 --- a/competition/fixtures/competition_types.json +++ b/competition/fixtures/competition_types.json @@ -3,42 +3,48 @@ "model": "competition.CompetitionType", "pk": 0, "fields": { - "name": "Seminár" + "name": "Seminár", + "short_name": "seminár" } }, { "model": "competition.CompetitionType", "pk": 1, "fields": { - "name": "Jednodňová tímová súťaž" + "name": "Jednodňová tímová súťaž", + "short_name": "súťaž" } }, { "model": "competition.CompetitionType", "pk": 2, "fields": { - "name": "Tábor" + "name": "Tábor", + "short_name": "tábor" } }, { "model": "competition.CompetitionType", "pk": 3, "fields": { - "name": "Šifrovacia hra" + "name": "Šifrovacia hra", + "short_name": "šifrovačka" } }, { "model": "competition.CompetitionType", "pk": 4, "fields": { - "name": "Robotická tímová súťaž" + "name": "Robotická tímová súťaž", + "short_name": "súťaž" } }, { "model": "competition.CompetitionType", "pk": 5, "fields": { - "name": "Individuálna online súťaž" + "name": "Individuálna online súťaž", + "short_name": "súťaž" } } ] \ No newline at end of file diff --git a/competition/fixtures/events.json b/competition/fixtures/events.json index e5d47d1..8c20d28 100644 --- a/competition/fixtures/events.json +++ b/competition/fixtures/events.json @@ -7,7 +7,8 @@ "year": 19, "school_year": "2021/2022", "start": "2022-06-01T20:00:00+02:00", - "end": "2022-06-02T20:00:00+02:00" + "end": "2022-06-02T20:00:00+02:00", + "location": "v Košiciach" } }, { @@ -41,7 +42,8 @@ "school_year": "2022/2023", "start": "2023-06-01T20:00:00+02:00", "end": "2025-06-01T20:00:00+02:00", - "registration_link": 3 + "registration_link": 3, + "location": "v Košiciach" } } diff --git a/competition/models.py b/competition/models.py index 9e30029..0aa2a2b 100644 --- a/competition/models.py +++ b/competition/models.py @@ -36,6 +36,8 @@ class Meta: verbose_name_plural = 'Typy súťaží' name = models.CharField('typ súťaže', max_length=200) + short_name = models.CharField( + verbose_name='Krátky jednoslovný názov', max_length=32) def __str__(self): return self.name @@ -161,6 +163,8 @@ class Meta: start = models.DateTimeField(verbose_name='dátum začiatku súťaže') end = models.DateTimeField(verbose_name='dátum konca súťaže') + location = models.TextField( + verbose_name='Miesto konania', help_text='Napríklad "v Košiciach"', null=True, blank=True) additional_name = models.CharField( max_length=50, verbose_name='Prívlastok súťaže', null=True, blank=True) From 2c601872f413585810c8d113b3a242359ee8f82e Mon Sep 17 00:00:00 2001 From: kovacspe Date: Thu, 23 May 2024 23:15:38 +0200 Subject: [PATCH 3/3] lint --- competition/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/competition/models.py b/competition/models.py index 0aa2a2b..72c24f5 100644 --- a/competition/models.py +++ b/competition/models.py @@ -803,7 +803,7 @@ def can_user_modify(self, user): return self.event.can_user_modify(user) def __str__(self): - return str(self.event) + return str(self.event) # pylint: disable=no-member class ProblemCorrection(models.Model):