Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add __str__ method dor RegistrationLink #390

Merged
merged 3 commits into from
May 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading