Keine Ahnung / not known

This commit is contained in:
2018-06-22 15:03:25 +02:00
parent 91f210883f
commit 2fa6dd0709
3 changed files with 29 additions and 21 deletions

View File

@@ -34,23 +34,25 @@
data-target="#collapseBeispiel" aria-expanded="false" aria-controls="collapseBeispiel"> data-target="#collapseBeispiel" aria-expanded="false" aria-controls="collapseBeispiel">
Liga hinzufügen</button> Liga hinzufügen</button>
<div class="collapse" id="collapseBeispiel"> <div class="collapse" id="collapseBeispiel">
<table class="table table-striped"> <form role="form" action="" method="post">{% csrf_token %}
<tr> <table class="table table-striped">
<th>Liga</th> <tr>
<th>Abkürzung</th> <th>Liga</th>
<th>Saison</th> <th>Abkürzung</th>
<th>ID</th> <th>Saison</th>
</tr> <th>ID</th>
{% for i in avail_leagues %} </tr>
<tr> {% for i in avail_leagues %}
<td>{{ i.leagueName }}</td> <tr>
<td>{{ i.leagueShortcut }}</td> <td>{{ i.leagueName }}</td>
<td>{{ i.leagueSaison }}</td> <td>{{ i.leagueShortcut }}</td>
<td>{{ i.leagueID }}</td> <td>{{ i.leagueSaison }}</td>
</tr> <td>{{ i.leagueID }}</td>
{% endfor %} </tr>
</table> {% endfor %}
</div> </table>
</form>
</div>
</div> </div>
</div> </div>
{% if debug %} {% if debug %}

View File

@@ -69,7 +69,9 @@ class UserProfileForm(forms.ModelForm):
model = UserProfile model = UserProfile
fields = ['avatar'] fields = ['avatar']
"""
class LeagueImportForm(forms.Form): class LeagueImportForm(forms.Form):
leagues = leagues = forms.ChoiceField(
""" widget=forms.RadioSelect()
)

View File

@@ -151,7 +151,8 @@ def adminpage(request, pos='default', template_name='adminpage.html'):
debug = [] debug = []
lss = Match.objects.values('leagueShortcut').distinct(). \ lss = Match.objects.values('leagueShortcut').distinct(). \
values_list('leagueShortcut', flat=True) 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() ol = OpenLiga()
@@ -164,6 +165,9 @@ def adminpage(request, pos='default', template_name='adminpage.html'):
'leagueName' : l["leagueName"], 'leagueName' : l["leagueName"],
'leagueSaison' : l["leagueSaison"] 'leagueSaison' : l["leagueSaison"]
}) })
form_leagues = LeagueImportForm()
form_leagues.fields["leagues"].choices = avail_leagues
return render(request, template_name, { return render(request, template_name, {
'debug': debug, 'debug': debug,