Added country flags

This commit is contained in:
Felipe Martín 2015-06-23 00:18:26 +02:00
parent 5083d2d428
commit d9dee20758
3 changed files with 27 additions and 2 deletions

View File

@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('shop', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='shop',
name='flag_code',
field=models.CharField(max_length=2, null=True, blank=True),
),
]

View File

@ -11,7 +11,11 @@ class Shop(models.Model):
name = models.CharField(max_length=64)
slug = models.CharField(max_length=64)
url = models.CharField(max_length=64)
flag_code = models.CharField(max_length=2, blank=True, null=True)
referer_id = models.CharField(max_length=64, blank=True, null=True)
class Meta:
ordering = ('name', )
def __unicode__(self):
return self.name

View File

@ -47,6 +47,7 @@
<thead>
<tr>
<th>{% trans "Shop" %}</th>
<th class="center aligned" width="10">{% trans "Country" %}</th>
<th class="center aligned">{% trans "Stock" %}</th>
<th class="center aligned">{% trans "Price" %}</th>
</tr>
@ -55,9 +56,10 @@
{% for relation in amiibo.shops_set.all %}
<tr>
<td><a href="{{ relation.url }}">{{ relation.shop.name }}</a></td>
<td class="center aligned {{ relation.stock|yesno:'positive,negative'}}">
<td class="center aligned">{% if relation.shop.flag_code %}<i class="{{ relation.shop.flag_code }} flag"></i>{% endif %}</td>
<td class="center aligned {{ relation.stock|yesno:'positive,negative' }}">
<i class="icon {{ relation.stock|yesno:'checkmark,close' }}"></i>
{{ relation.stock|yesno }}
{{ relation.stock|yesno|capfirst }}
</td>
<td class="center aligned">{{ relation.last_price.price }}</td>
</tr>