Skip to content

Commit

Permalink
Add __str__ method dor RegistrationLink (#390)
Browse files Browse the repository at this point in the history
  • Loading branch information
kovacspe authored May 25, 2024
1 parent 7d3c7a5 commit b53f20f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
18 changes: 12 additions & 6 deletions competition/fixtures/competition_types.json
Original file line number Diff line number Diff line change
Expand Up @@ -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ž"
}
}
]
6 changes: 4 additions & 2 deletions competition/fixtures/events.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
},
{
Expand Down Expand Up @@ -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"
}
}

Expand Down
11 changes: 9 additions & 2 deletions competition/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -622,11 +626,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()


Expand Down Expand Up @@ -798,6 +802,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) # pylint: disable=no-member


class ProblemCorrection(models.Model):
# TODO: Add images
Expand Down

0 comments on commit b53f20f

Please sign in to comment.