That is, the button "read more >>" I did and it even functions as it should, but this button does not make sense because my posts are displayed in full. How to set character limits? This is the line that I think is decisive in my case. but how and where to apply it, I do not know. I just registered it in model.py

class Posts(models.Model): # v--- вот эта строчка ---v slug = models.CharField(verbose_name='lasha', max_length=100,blank=True) def get_abs_url(self): return '/blog/{0}/'.format(self.id) def __str__(self): return self.title 

    2 answers 2

    Models have nothing to do with it. A model is a means of interacting with a database. You need to look towards patterns. In particular, when passing the context to the template, trim the content, or use in the template itself the filter truncatechars (truncatewords) with a long text as an argument. See here: http://djbook.ru/rel1.8/ref/templates/builtins.html#truncatechars http://djbook.ru/rel1.8/ref/templates/builtins.html#truncatewords

    • In general, it is possible to add a field to the model containing the text before the “Read more” button (on many sites I saw this), but this is already to your taste - andreymal

    need to do

    1. context_processror to pass values ​​to a template
    2. in the template output fields
    3. add a button to read further with reference to the post