mirror of https://github.com/snachodog/mybuddy.git
Simplify core model names.
This commit is contained in:
parent
1f1d96093b
commit
c49b8d1930
|
@ -52,8 +52,15 @@ class DiaperChange(models.Model):
|
||||||
ordering = ['-time']
|
ordering = ['-time']
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return 'Diaper change for {} on {}'.format(
|
if self.wet and self.solid:
|
||||||
self.child, self.time.date())
|
name = 'Wet, solid ({}) diaper change'.format(self.color)
|
||||||
|
elif self.wet:
|
||||||
|
name = 'Wet diaper change'
|
||||||
|
elif self.solid:
|
||||||
|
name = self.solid = 'Solid ({}) diaper change'.format(self.color)
|
||||||
|
else:
|
||||||
|
name = 'Diaper change'
|
||||||
|
return name
|
||||||
|
|
||||||
def since(self, time=timezone.now()):
|
def since(self, time=timezone.now()):
|
||||||
return timesince.timesince(self.time, time)
|
return timesince.timesince(self.time, time)
|
||||||
|
@ -92,8 +99,10 @@ class Feeding(models.Model):
|
||||||
ordering = ['-start']
|
ordering = ['-start']
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return 'Feeding for {} on {} ({})'.format(
|
name = '{} ({}) feeding'.format(self.method, self.type)
|
||||||
self.child, self.end.date(), self.duration)
|
if self.amount:
|
||||||
|
name += ' ({} oz.)'.format(self.amount)
|
||||||
|
return name.capitalize()
|
||||||
|
|
||||||
def since(self, time=timezone.now()):
|
def since(self, time=timezone.now()):
|
||||||
return timesince.timesince(self.end, time)
|
return timesince.timesince(self.end, time)
|
||||||
|
@ -116,7 +125,7 @@ class Note(models.Model):
|
||||||
ordering = ['-time']
|
ordering = ['-time']
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return 'Note about {} on {}'.format(self.child, self.time.date())
|
return 'Note about {}'.format(self.child)
|
||||||
|
|
||||||
def since(self, time=timezone.now()):
|
def since(self, time=timezone.now()):
|
||||||
return timesince.timesince(self.time, time)
|
return timesince.timesince(self.time, time)
|
||||||
|
@ -136,8 +145,7 @@ class Sleep(models.Model):
|
||||||
verbose_name_plural = 'Sleep'
|
verbose_name_plural = 'Sleep'
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return 'Sleep for {} on {} ({})'.format(
|
return 'Sleep ({})'.format(self.duration)
|
||||||
self.child, self.end.date(), self.duration)
|
|
||||||
|
|
||||||
def since(self, time=timezone.now()):
|
def since(self, time=timezone.now()):
|
||||||
return timesince.timesince(self.end, time)
|
return timesince.timesince(self.end, time)
|
||||||
|
@ -208,8 +216,7 @@ class TummyTime(models.Model):
|
||||||
ordering = ['-start']
|
ordering = ['-start']
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return 'Tummy time for {} on {} ({})'.format(
|
return 'Tummy time ({})'.format(self.duration)
|
||||||
self.child, self.end.date(), self.duration)
|
|
||||||
|
|
||||||
def duration_td(self):
|
def duration_td(self):
|
||||||
return self.end - self.start
|
return self.end - self.start
|
||||||
|
|
Loading…
Reference in New Issue