2009-12-19 22:27:26 +08:00
|
|
|
from django.db import models
|
2012-08-12 18:32:08 +08:00
|
|
|
from django.utils.encoding import python_2_unicode_compatible
|
2009-12-19 22:27:26 +08:00
|
|
|
|
2011-10-14 02:04:12 +08:00
|
|
|
|
2012-08-12 18:32:08 +08:00
|
|
|
@python_2_unicode_compatible
|
2009-12-19 22:27:26 +08:00
|
|
|
class Article(models.Model):
|
|
|
|
headline = models.CharField(max_length=100, default='Default headline')
|
|
|
|
pub_date = models.DateTimeField()
|
|
|
|
|
2012-08-12 18:32:08 +08:00
|
|
|
def __str__(self):
|
2009-12-19 22:27:26 +08:00
|
|
|
return self.headline
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
app_label = 'fixtures_model_package'
|
|
|
|
ordering = ('-pub_date', 'headline')
|
|
|
|
|
2011-11-27 21:00:56 +08:00
|
|
|
class Book(models.Model):
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
ordering = ('name',)
|