Where to store simple texts

40 views
Skip to first unread message

Nikolay Steblin-Kamenskiy

unread,
Dec 9, 2016, 3:15:21 PM12/9/16
to Django users
I have created a simple page a sort of announcement and I doubt that I put my text smart enogh. Would love to hear comment of more experienced users. 
Where are several blocks of text. One of it I've put directly into html template (using "p" tag for each line). For another one (a list) I have created a django module as I wanted to do 'for loop' in the template for each paragraph. But some of this paragraph I've slightly changed in the html template again using (if instance.id == ) clause. 

It's quite painful now to update those texts as they are stored in different places. What would you do? Could I create a couple of .txt files and retrieve texts from them? 

Sujit Roy

unread,
Dec 10, 2016, 1:47:57 PM12/10/16
to Django users
in your sqlite database u just create a model

Derek

unread,
Dec 11, 2016, 3:02:13 AM12/11/16
to Django users
And in the model, have a field in which you store the text - you can edit this field via something like TinyMCE (https://django-tinymce.readthedocs.io/en/latest/).

If it is just a few, fixed pages; you can also use https://docs.djangoproject.com/en/1.10/ref/contrib/flatpages/ 
Reply all
Reply to author
Forward
0 new messages