2012-11-20 20:15:16 +08:00
|
|
|
from django.core.urlresolvers import reverse
|
2010-10-18 21:34:47 +08:00
|
|
|
from django.db import models
|
2012-08-12 18:32:08 +08:00
|
|
|
from django.utils.encoding import python_2_unicode_compatible
|
2010-10-18 21:34:47 +08:00
|
|
|
|
2011-10-14 05:34:56 +08:00
|
|
|
|
2012-08-12 18:32:08 +08:00
|
|
|
@python_2_unicode_compatible
|
2010-10-18 21:34:47 +08:00
|
|
|
class Artist(models.Model):
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
ordering = ['name']
|
2011-01-03 21:15:58 +08:00
|
|
|
verbose_name = 'professional artist'
|
|
|
|
verbose_name_plural = 'professional artists'
|
2010-10-18 21:34:47 +08:00
|
|
|
|
2012-08-12 18:32:08 +08:00
|
|
|
def __str__(self):
|
2010-10-18 21:34:47 +08:00
|
|
|
return self.name
|
|
|
|
|
|
|
|
def get_absolute_url(self):
|
2012-11-20 20:15:16 +08:00
|
|
|
return reverse('artist_detail', kwargs={'pk': self.id})
|
2010-10-18 21:34:47 +08:00
|
|
|
|
2013-11-03 12:36:09 +08:00
|
|
|
|
2012-08-12 18:32:08 +08:00
|
|
|
@python_2_unicode_compatible
|
2010-10-18 21:34:47 +08:00
|
|
|
class Author(models.Model):
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
slug = models.SlugField()
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
ordering = ['name']
|
|
|
|
|
2012-08-12 18:32:08 +08:00
|
|
|
def __str__(self):
|
2010-10-18 21:34:47 +08:00
|
|
|
return self.name
|
|
|
|
|
2013-11-03 12:36:09 +08:00
|
|
|
|
2012-08-12 18:32:08 +08:00
|
|
|
@python_2_unicode_compatible
|
2010-10-18 21:34:47 +08:00
|
|
|
class Book(models.Model):
|
|
|
|
name = models.CharField(max_length=300)
|
|
|
|
slug = models.SlugField()
|
|
|
|
pages = models.IntegerField()
|
|
|
|
authors = models.ManyToManyField(Author)
|
|
|
|
pubdate = models.DateField()
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
ordering = ['-pubdate']
|
|
|
|
|
2012-08-12 18:32:08 +08:00
|
|
|
def __str__(self):
|
2010-10-18 21:34:47 +08:00
|
|
|
return self.name
|
|
|
|
|
2013-11-03 12:36:09 +08:00
|
|
|
|
2010-10-18 21:34:47 +08:00
|
|
|
class Page(models.Model):
|
|
|
|
content = models.TextField()
|
|
|
|
template = models.CharField(max_length=300)
|
2012-05-01 02:41:38 +08:00
|
|
|
|
2013-11-03 12:36:09 +08:00
|
|
|
|
2012-05-01 02:41:38 +08:00
|
|
|
class BookSigning(models.Model):
|
|
|
|
event_date = models.DateTimeField()
|