-class BookStub(models.Model):
- title = models.CharField(_('title'), max_length=120)
- author = models.CharField(_('author'), max_length=120)
- pd = models.IntegerField(_('goes to public domain'), null=True, blank=True)
- slug = models.SlugField(_('slug'), max_length=120, unique=True, db_index=True)
- translator = models.TextField(_('translator'), blank=True)
- translator_death = models.TextField(_('year of translator\'s death'), blank=True)
-
- class Meta:
- ordering = ('title',)
- verbose_name = _('book stub')
- verbose_name_plural = _('book stubs')
-
- def __unicode__(self):
- return self.title
-
- @permalink
- def get_absolute_url(self):
- return ('catalogue.views.book_detail', [self.slug])
-
- def in_pd(self):
- return self.pd is not None and self.pd <= datetime.now().year
-
- @property
- def name(self):
- return self.title
-
-