Update to new librarian api for html, txt.
[wolnelektury.git] / src / references / models.py
index c986471..f83518d 100644 (file)
@@ -65,7 +65,8 @@ class Entity(models.Model):
                 result_data['thumbwidth'],
                 result_data['thumbheight']
             ]
-            image_data['responsiveUrls'] = result_data['responsiveUrls']
+            if 'responsiveUrls' in result_data:
+                image_data['responsiveUrls'] = result_data['responsiveUrls']
 
             image_data_list.append(image_data)
 
@@ -75,8 +76,16 @@ class Entity(models.Model):
 class Reference(models.Model):
     book = models.ForeignKey('catalogue.Book', models.CASCADE)
     entity = models.ForeignKey(Entity, models.CASCADE)
-    first_section = models.CharField(max_length=255)
 
     class Meta:
         unique_together = (('book', 'entity'),)
 
+
+class Occurence(models.Model):
+    reference = models.ForeignKey(Reference, models.CASCADE)
+    section = models.IntegerField()
+    anchor = models.CharField(max_length=64)
+    html = models.TextField()
+
+    class Meta:
+        ordering = ('section',)