define default ordering and list_filter

This commit is contained in:
Fred Pauchet 2016-09-28 13:59:22 +02:00
parent 705ee062bc
commit 7bb2b23ba5
4 changed files with 5 additions and 1 deletions

View File

@ -4,7 +4,7 @@ before_script:
test:python-3.4:
stage: test
image: python:3.4-slim
script:
script:
- flake8 src/
- coverage run src/manage.py test sherlock
- coverage report -m

Binary file not shown.

View File

@ -8,6 +8,7 @@ class MesureAdmin(admin.ModelAdmin):
model = Mesure
list_display = ('__str__', 'value', 'category')
list_filter = ('gauge__category',)
admin.site.register(Category)
admin.site.register(Gauge)

View File

@ -41,6 +41,9 @@ class Mesure(models.Model):
objects = MesureManager()
class Meta:
ordering = ('-moment',)
def __str__(self):
return "{} {}".format(self.moment.strftime('%Y-%m-%d %H:%M'), self.value)