Finished templates for new HTTP method

This commit is contained in:
2016-06-08 08:15:54 +02:00
parent d99eee4751
commit 4b2f7e4641
3 changed files with 34 additions and 5 deletions

View File

@@ -58,11 +58,19 @@
{% if match.started and not match.finished %}
<tr class="danger">{% else %}<tr>{% endif %}
<td>{{ match.matchDateTime }}</td>
{% if match.iconURLTeam1 != "" %}
<td><img src="{{ match.iconURLTeam1 }}" width="20"/>
{% else %}
<td><img src="{{ STATIC_URL}}{{ match.iconTeam1 }}" />
{% endif %}
<span class="hidden-xs"> {{ match.nameTeam1 }}</span>
<span class="visible-xs"> {{ match.abbrTeam1 }}</span>
</td>
{% if match.iconURLTeam1 != "" %}
<td><img src="{{ match.iconURLTeam2 }}" width="20"/>
{% else %}
<td><img src="{{ STATIC_URL}}{{ match.iconTeam2 }}" />
{% endif %}
<span class="hidden-xs"> {{ match.nameTeam2 }}</span>
<span class="visible-xs"> {{ match.abbrTeam2 }}</span>
</td>
@@ -87,8 +95,19 @@
<th>Tipper</th>
<th>Gesamt</th>
{% for match in matches %}
<th><img src="{{ STATIC_URL }}{{ match.iconTeam1 }}" /><br /><br />
<img src="{{ STATIC_URL }}{{ match.iconTeam2 }}" /></th>
<th>
{% if match.iconURLTeam1 != "" %}
<img src="{{ match.iconURLTeam1 }}" width="20"/>
{% else %}
<img src="{{ STATIC_URL }}{{ match.iconTeam1 }}" />
{% endif %}
<br /><br />
{% if match.iconURLTeam2 != "" %}
<img src="{{ match.iconURLTeam2 }}" width="20"/>
{% else %}
<img src="{{ STATIC_URL }}{{ match.iconTeam2 }}" />
{% endif %}
</th>
{% endfor %}
</tr>
{% for mate in tipp_mates %}

View File

@@ -42,10 +42,16 @@ class Team(models.Model):
name = models.CharField(max_length=200)
icon = models.FileField(upload_to="images/team_logos/")
abbr = models.CharField(max_length=3)
iconURL = models.CharField(max_length=2000)
def __unicode__(self):
return self.name
class Meta:
managed = True
app_label = 'tipp'
class Match(models.Model):
matchID = models.IntegerField(unique=True,primary_key=True)
matchDateTime = models.DateTimeField()

View File

@@ -141,10 +141,12 @@ def getSeason(request, ls, season):
for team in teams[0]:
t = Team(
teamID=team['teamID'],
name=team['teamName']
name=team['teamName'],
iconURL = team['teamIconURL']
)
t.save()
for match in season[0]:
m = Match(matchID=unicode(match['matchID']),
matchDateTime=datetime.strptime(unicode(match['matchDateTime']), '%Y-%m-%d %H:%M:%S'),
@@ -339,9 +341,11 @@ def matchday(request, ls, season, matchday, template_name='md.html'):
item['matchDateTime'] = (match.matchDateTime.astimezone(timezoneLocal).strftime('%a %d.%m, %H:%M'))
item['iconTeam1']= str(match.idTeam1.icon)
item['iconURLTeam1'] = str(match.idTeam1.iconURL)
item['nameTeam1']= str(match.idTeam1)
item['abbrTeam1']= str(match.idTeam1.abbr)
item['iconTeam2'] = str(match.idTeam2.icon)
item['iconURLTeam2'] = str(match.idTeam2.iconURL)
item['nameTeam2'] = str(match.idTeam2)
item['abbrTeam2']= str(match.idTeam2.abbr)
item['started'] = match_started