2017-05-29 00:01:56 +01:00
|
|
|
from asyncorm import models
|
2017-03-27 22:47:35 +01:00
|
|
|
|
|
|
|
|
|
|
|
BOOK_CHOICES = (
|
|
|
|
('hard cover', 'hard cover book'),
|
|
|
|
('paperback', 'paperback book')
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
# This is a simple model definition
|
2017-05-29 00:01:56 +01:00
|
|
|
class Book(models.Model):
|
|
|
|
name = models.CharField(max_length=50)
|
|
|
|
synopsis = models.CharField(max_length=255)
|
|
|
|
book_type = models.CharField(
|
|
|
|
max_length=15,
|
|
|
|
null=True,
|
|
|
|
choices=BOOK_CHOICES
|
|
|
|
)
|
|
|
|
pages = models.IntegerField(null=True)
|
|
|
|
date_created = models.DateField(auto_now=True)
|
2017-03-27 22:47:35 +01:00
|
|
|
|
|
|
|
class Meta():
|
2017-05-29 00:01:56 +01:00
|
|
|
ordering = ['-name', ]
|
2017-03-27 22:47:35 +01:00
|
|
|
unique_together = ['name', 'synopsis']
|