summaryrefslogtreecommitdiff
path: root/app/books/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/books/models.py')
-rw-r--r--app/books/models.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/app/books/models.py b/app/books/models.py
index 173b5f6..7af5d5c 100644
--- a/app/books/models.py
+++ b/app/books/models.py
@@ -1,6 +1,6 @@
from django.db import models
from django.template.defaultfilters import slugify
-from taggit.managers import TaggableManager
+from taggit.managers import TaggableManager
class Book(models.Model):
@@ -10,13 +10,13 @@ class Book(models.Model):
year_pub = models.CharField(max_length=4, blank=True, null=True)
read_date = models.DateTimeField()
isbn = models.CharField(max_length=100, blank=True, null=True)
-
+
body_html = models.TextField(null=True, blank=True)
-
+
url = models.CharField(max_length=200, blank=True, null=True)
#tags = TaggableManager(blank=True, null=True)
- tags = models.CharField(max_length=200,blank=True, null=True)
+ tags = models.CharField(max_length=200, blank=True, null=True)
RATINGS = (
('1', "1 Star"),
('2', "2 Stars"),
@@ -29,14 +29,15 @@ class Book(models.Model):
class Meta:
ordering = ('-read_date',)
-
+
def __str__(self):
return self.title
-
+
def save(self, *args, **kwargs):
self.slug = slugify(self.title[:50])
super(Book, self).save()
+
class BookHighlight(models.Model):
book = models.ForeignKey(Book)
page = models.PositiveSmallIntegerField(null=True)
@@ -48,7 +49,8 @@ class BookHighlight(models.Model):
ordering = ('-date_added',)
def __str__(self):
- return "%s%s" %(self.book.title, self.id)
+ return "%s%s" % (self.book.title, self.id)
+
class BookNote(BookHighlight):
pass