From 2fa6dd07094edabbe3914ca34c14f68fb43b325e Mon Sep 17 00:00:00 2001 From: Martin Bley Date: Fri, 22 Jun 2018 15:03:25 +0200 Subject: [PATCH] Keine Ahnung / not known --- templates/adminpage.html | 36 +++++++++++++++++++----------------- tipp/forms.py | 8 +++++--- tipp/views.py | 6 +++++- 3 files changed, 29 insertions(+), 21 deletions(-) diff --git a/templates/adminpage.html b/templates/adminpage.html index 0ea0630..f476c09 100644 --- a/templates/adminpage.html +++ b/templates/adminpage.html @@ -34,23 +34,25 @@ data-target="#collapseBeispiel" aria-expanded="false" aria-controls="collapseBeispiel"> Liga hinzufügen
- - - - - - - - {% for i in avail_leagues %} - - - - - - - {% endfor %} -
LigaAbkürzungSaisonID
{{ i.leagueName }}{{ i.leagueShortcut }}{{ i.leagueSaison }}{{ i.leagueID }}
-
+
{% csrf_token %} + + + + + + + + {% for i in avail_leagues %} + + + + + + + {% endfor %} +
LigaAbkürzungSaisonID
{{ i.leagueName }}{{ i.leagueShortcut }}{{ i.leagueSaison }}{{ i.leagueID }}
+
+ {% if debug %} diff --git a/tipp/forms.py b/tipp/forms.py index b8c1068..7735b8b 100644 --- a/tipp/forms.py +++ b/tipp/forms.py @@ -69,7 +69,9 @@ class UserProfileForm(forms.ModelForm): model = UserProfile fields = ['avatar'] -""" class LeagueImportForm(forms.Form): - leagues = -""" + leagues = forms.ChoiceField( + widget=forms.RadioSelect() + ) + + diff --git a/tipp/views.py b/tipp/views.py index f1f540f..e8f0d46 100644 --- a/tipp/views.py +++ b/tipp/views.py @@ -151,7 +151,8 @@ def adminpage(request, pos='default', template_name='adminpage.html'): debug = [] lss = Match.objects.values('leagueShortcut').distinct(). \ values_list('leagueShortcut', flat=True) - leagues = Competition.objects.values('leagueShortcut', 'leagueName').filter(leagueShortcut__in=lss) + leagues = Competition.objects.values('leagueShortcut', 'leagueName').\ + filter(leagueShortcut__in=lss) ol = OpenLiga() @@ -164,6 +165,9 @@ def adminpage(request, pos='default', template_name='adminpage.html'): 'leagueName' : l["leagueName"], 'leagueSaison' : l["leagueSaison"] }) + + form_leagues = LeagueImportForm() + form_leagues.fields["leagues"].choices = avail_leagues return render(request, template_name, { 'debug': debug,