Order tables

This commit is contained in:
Yohann D'ANELLO 2020-05-05 16:04:53 +02:00
parent bfba07b7a2
commit 333b04a01b
4 changed files with 7 additions and 2 deletions

View File

@ -30,7 +30,7 @@ class TournamentForm(forms.ModelForm):
class Meta: class Meta:
model = Tournament model = Tournament
fields = '__all__' exclude = ('year',)
widgets = { widgets = {
"price": AmountInput(), "price": AmountInput(),
"date_start": DatePickerInput(), "date_start": DatePickerInput(),

View File

@ -26,6 +26,7 @@ class TournamentTable(tables.Table):
attrs = { attrs = {
'class': 'table table-condensed table-striped table-hover' 'class': 'table table-condensed table-striped table-hover'
} }
order_by = ('date_start', 'name',)
class TeamTable(tables.Table): class TeamTable(tables.Table):
@ -40,6 +41,7 @@ class TeamTable(tables.Table):
attrs = { attrs = {
'class': 'table table-condensed table-striped table-hover' 'class': 'table table-condensed table-striped table-hover'
} }
order_by = ('-validation_status', 'trigram',)
class SolutionTable(tables.Table): class SolutionTable(tables.Table):

View File

@ -427,7 +427,8 @@ class PoolListView(LoginRequiredMixin, SingleTableView):
qs = qs.filter(Q(juries=user) | Q(teams__tournament__organizers=user)) qs = qs.filter(Q(juries=user) | Q(teams__tournament__organizers=user))
elif user.participates: elif user.participates:
qs = qs.filter(teams=user.team) qs = qs.filter(teams=user.team)
return qs.distinct() qs = qs.distinct().order_by('teams__tournament__date_start', 'teams__tournament__name', 'round',)
return qs
class PoolCreateView(AdminMixin, CreateView): class PoolCreateView(AdminMixin, CreateView):

View File

@ -157,6 +157,8 @@ USE_TZ = True
LOCALE_PATHS = [os.path.join(BASE_DIR, "locale")] LOCALE_PATHS = [os.path.join(BASE_DIR, "locale")]
FIXTURE_DIRS = [os.path.join(BASE_DIR, "tfjm/fixtures")]
# Static files (CSS, JavaScript, Images) # Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.0/howto/static-files/ # https://docs.djangoproject.com/en/3.0/howto/static-files/