Make verse numbers, footnote anchors, themes, dynamic inserts unselectable. Fixes...
[wolnelektury.git] / src / lesmianator / models.py
index f12f1d7..9e2f166 100644 (file)
@@ -17,7 +17,6 @@ from django.contrib.contenttypes.fields import GenericForeignKey
 from django.conf import settings
 from django.urls import reverse
 
 from django.conf import settings
 from django.urls import reverse
 
-from jsonfield import JSONField
 from catalogue.models import Book, Tag
 
 
 from catalogue.models import Book, Tag
 
 
@@ -25,7 +24,7 @@ class Poem(models.Model):
     slug = models.SlugField(_('slug'), max_length=120, db_index=True)
     text = models.TextField(_('text'))
     created_by = models.ForeignKey(User, models.SET_NULL, null=True)
     slug = models.SlugField(_('slug'), max_length=120, db_index=True)
     text = models.TextField(_('text'))
     created_by = models.ForeignKey(User, models.SET_NULL, null=True)
-    created_from = JSONField(_('extra information'), null=True, blank=True)
+    created_from = models.TextField(_('extra information'), null=True, blank=True)
     created_at = models.DateTimeField(_('creation date'), auto_now_add=True, editable=False)
     seen_at = models.DateTimeField(_('last view date'), auto_now_add=True, editable=False)
     view_count = models.IntegerField(_('view count'), default=1)
     created_at = models.DateTimeField(_('creation date'), auto_now_add=True, editable=False)
     seen_at = models.DateTimeField(_('last view date'), auto_now_add=True, editable=False)
     view_count = models.IntegerField(_('view count'), default=1)
@@ -48,7 +47,7 @@ class Poem(models.Model):
     @staticmethod
     def choose_letter(word, continuations):
         if word not in continuations:
     @staticmethod
     def choose_letter(word, continuations):
         if word not in continuations:
-            return u'\n'
+            return '\n'
 
         choices = sum((continuations[word][letter]
                        for letter in continuations[word]))
 
         choices = sum((continuations[word][letter]
                        for letter in continuations[word]))
@@ -67,7 +66,7 @@ class Poem(models.Model):
             return ''
 
         letters = []
             return ''
 
         letters = []
-        word = u''
+        word = ''
 
         finished_stanza_verses = 0
         current_stanza_verses = 0
 
         finished_stanza_verses = 0
         current_stanza_verses = 0
@@ -83,7 +82,7 @@ class Poem(models.Model):
             word = word[-length + 1:] + letter
             char_count += 1
 
             word = word[-length + 1:] + letter
             char_count += 1
 
-            if letter == u'\n':
+            if letter == '\n':
                 if verse_start:
                     finished_stanza_verses += current_stanza_verses
                     current_stanza_verses = 0
                 if verse_start:
                     finished_stanza_verses += current_stanza_verses
                     current_stanza_verses = 0