2017-08-13 14:48:16 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
from __future__ import unicode_literals
|
|
|
|
|
2017-08-11 18:32:02 +00:00
|
|
|
from django.contrib import admin
|
2017-11-19 01:57:29 +00:00
|
|
|
from django.conf import settings
|
2017-08-11 18:32:02 +00:00
|
|
|
|
2017-11-10 02:15:09 +00:00
|
|
|
from core import models
|
2017-08-13 14:48:16 +00:00
|
|
|
|
|
|
|
|
2017-11-10 02:15:09 +00:00
|
|
|
@admin.register(models.Child)
|
2017-08-16 12:49:58 +00:00
|
|
|
class ChildAdmin(admin.ModelAdmin):
|
2017-08-18 12:08:23 +00:00
|
|
|
list_display = ('first_name', 'last_name', 'birth_date', 'slug')
|
2017-08-13 20:15:57 +00:00
|
|
|
list_filter = ('last_name',)
|
2017-11-19 02:06:37 +00:00
|
|
|
search_fields = ('first_name', 'last_name', 'birth_date')
|
|
|
|
fields = ['first_name', 'last_name', 'birth_date']
|
2017-11-19 01:57:29 +00:00
|
|
|
if settings.ALLOW_UPLOADS:
|
|
|
|
fields.append('picture')
|
2017-08-13 14:48:16 +00:00
|
|
|
|
|
|
|
|
2017-11-10 02:15:09 +00:00
|
|
|
@admin.register(models.DiaperChange)
|
2017-08-13 19:51:25 +00:00
|
|
|
class DiaperChangeAdmin(admin.ModelAdmin):
|
2017-08-16 14:29:53 +00:00
|
|
|
list_display = ('child', 'time', 'wet', 'solid', 'color')
|
|
|
|
list_filter = ('child', 'wet', 'solid', 'color')
|
|
|
|
search_fields = ('child__first_name', 'child__last_name',)
|
2017-08-13 19:51:25 +00:00
|
|
|
|
|
|
|
|
2017-11-10 02:15:09 +00:00
|
|
|
@admin.register(models.Feeding)
|
2017-08-13 15:59:14 +00:00
|
|
|
class FeedingAdmin(admin.ModelAdmin):
|
2017-08-16 22:07:25 +00:00
|
|
|
list_display = ('start', 'end', 'duration', 'child', 'type', 'method',
|
|
|
|
'amount')
|
2017-08-16 14:29:53 +00:00
|
|
|
list_filter = ('child', 'type', 'method',)
|
2017-08-16 22:07:25 +00:00
|
|
|
search_fields = ('child__first_name', 'child__last_name', 'type',
|
|
|
|
'method',)
|
2017-08-13 15:59:14 +00:00
|
|
|
|
|
|
|
|
2017-11-10 02:15:09 +00:00
|
|
|
@admin.register(models.Note)
|
2017-08-13 20:48:16 +00:00
|
|
|
class NoteAdmin(admin.ModelAdmin):
|
2017-08-16 14:29:53 +00:00
|
|
|
list_display = ('time', 'child', 'note',)
|
|
|
|
list_filter = ('child',)
|
|
|
|
search_fields = ('child__last_name',)
|
2017-08-13 20:48:16 +00:00
|
|
|
|
|
|
|
|
2017-11-10 02:15:09 +00:00
|
|
|
@admin.register(models.Sleep)
|
2017-08-13 14:48:16 +00:00
|
|
|
class SleepAdmin(admin.ModelAdmin):
|
2017-11-04 11:59:28 +00:00
|
|
|
list_display = ('start', 'end', 'duration', 'child', 'nap')
|
2017-08-16 14:29:53 +00:00
|
|
|
list_filter = ('child',)
|
|
|
|
search_fields = ('child__first_name', 'child__last_name',)
|
2017-08-13 19:05:44 +00:00
|
|
|
|
|
|
|
|
2017-11-10 02:15:09 +00:00
|
|
|
@admin.register(models.Timer)
|
2017-08-16 22:33:02 +00:00
|
|
|
class TimerAdmin(admin.ModelAdmin):
|
2017-08-17 18:42:44 +00:00
|
|
|
list_display = ('name', 'start', 'end', 'duration', 'active', 'user')
|
|
|
|
list_filter = ('active', 'user')
|
|
|
|
search_fields = ('name', 'user')
|
2017-08-16 22:33:02 +00:00
|
|
|
|
|
|
|
|
2017-11-10 02:15:09 +00:00
|
|
|
@admin.register(models.TummyTime)
|
2017-08-13 19:05:44 +00:00
|
|
|
class TummyTimeAdmin(admin.ModelAdmin):
|
2017-08-16 14:29:53 +00:00
|
|
|
list_display = ('start', 'end', 'duration', 'child', 'milestone',)
|
|
|
|
list_filter = ('child',)
|
|
|
|
search_fields = ('child__first_name', 'child__last_name', 'milestone',)
|
2017-11-10 02:15:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
@admin.register(models.Weight)
|
|
|
|
class WeightAdmin(admin.ModelAdmin):
|
|
|
|
list_display = ('child', 'weight', 'date',)
|
|
|
|
list_filter = ('child',)
|
|
|
|
search_fields = ('child__first_name', 'child__last_name', 'weight',)
|