define default ordering and list_filter
This commit is contained in:
parent
705ee062bc
commit
7bb2b23ba5
|
@ -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
|
||||
|
|
BIN
src/db.sqlite3
BIN
src/db.sqlite3
Binary file not shown.
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue