X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/8b70aa73fd8c978601404f2feab6742517cad203..3618eb351066fde7992f64c81a053d0a89db2235:/catalogue/models.py?ds=sidebyside diff --git a/catalogue/models.py b/catalogue/models.py index f4d28037d..71c89a234 100644 --- a/catalogue/models.py +++ b/catalogue/models.py @@ -102,7 +102,6 @@ class Book(models.Model): def save(self, **kwargs): try: from bin import book2html - from django.conf import settings from os.path import splitext, basename from tempfile import NamedTemporaryFile @@ -129,27 +128,17 @@ class Book(models.Model): return self.title -# class Fragment(models.Model): -# id = models.IntegerField(primary_key=True) -# text = models.TextField(blank=True) -# start_paragraph = models.IntegerField(null=True, blank=True) -# book_id = models.IntegerField(null=True, blank=True) -# class Meta: -# db_table = u'fragment' - - -# class Inflections(models.Model): -# word = models.CharField(max_length=120, primary_key=True) -# cases = models.TextField() # This field type is a guess. -# class Meta: -# db_table = u'inflections' - - -# class Paragraph(models.Model): -# id = models.IntegerField(primary_key=True) -# number = models.IntegerField(null=True, blank=True) -# text = models.TextField(blank=True) -# book_id = models.IntegerField(null=True, blank=True) -# class Meta: -# db_table = u'paragraph' +class Fragment(models.Model): + text = models.TextField() + short_text = models.TextField() + anchor = models.IntegerField() + book = models.ForeignKey(Book) + + objects = managers.ModelTaggedItemManager(Tag) + tags = managers.TagDescriptor(Tag) + + class Meta: + ordering = ('book', 'anchor',) + verbose_name = _('fragment') + verbose_name_plural = _('fragment')