2007-06-23 22:16:00 +08:00
|
|
|
"""
|
|
|
|
This is a basic model to test saving and loading boolean and date-related
|
|
|
|
types, which in the past were problematic for some database backends.
|
|
|
|
"""
|
|
|
|
|
2010-09-27 23:13:43 +08:00
|
|
|
from django.db import models
|
2012-08-12 18:32:08 +08:00
|
|
|
from django.utils.encoding import python_2_unicode_compatible
|
2007-06-23 22:16:00 +08:00
|
|
|
|
2011-10-14 02:51:33 +08:00
|
|
|
|
2012-08-12 18:32:08 +08:00
|
|
|
@python_2_unicode_compatible
|
2007-06-23 22:16:00 +08:00
|
|
|
class Donut(models.Model):
|
2007-08-05 13:14:46 +08:00
|
|
|
name = models.CharField(max_length=100)
|
2007-06-23 22:16:00 +08:00
|
|
|
is_frosted = models.BooleanField(default=False)
|
|
|
|
has_sprinkles = models.NullBooleanField()
|
|
|
|
baked_date = models.DateField(null=True)
|
|
|
|
baked_time = models.TimeField(null=True)
|
|
|
|
consumed_at = models.DateTimeField(null=True)
|
2009-03-14 03:57:00 +08:00
|
|
|
review = models.TextField()
|
2007-06-23 22:16:00 +08:00
|
|
|
|
|
|
|
class Meta:
|
|
|
|
ordering = ('consumed_at',)
|
|
|
|
|
2012-08-12 18:32:08 +08:00
|
|
|
def __str__(self):
|
2007-06-23 22:16:00 +08:00
|
|
|
return self.name
|
2010-10-09 00:14:10 +08:00
|
|
|
|
2013-11-03 12:36:09 +08:00
|
|
|
|
2010-10-09 00:14:10 +08:00
|
|
|
class RumBaba(models.Model):
|
|
|
|
baked_date = models.DateField(auto_now_add=True)
|
|
|
|
baked_timestamp = models.DateTimeField(auto_now_add=True)
|