E
E
ekzotika2020-10-02 13:28:25
Django
ekzotika, 2020-10-02 13:28:25

Why don't template tags work?

Why don't template_tags display content?

models.py

@register_snippet
class RegisterPageText2(models.Model):
    title = models.CharField(max_length=255)
    text = RichTextField()

    def __str__(self):
        return self.title


wtpages_tags.py
@register.inclusion_tag('form.html', takes_context=True)
def texts(context):
    print(RegisterPageText2.objects.all())
    return {
        'texts': RegisterPageText2.objects.all(),
        'request': context['request'],
    }


form.html
{% load i18n  %}
{% load wagtailcore_tags %}
{% load wtpages_tags %}
<div class="form-order">
    <div class="container">
        <h1>Оформить счет на оплату OzonePRO</h1> <a onclick="closeForm()"><img src="/static_files/images/close-gray.png"></a>

        {% for text in texts %}
                <p>{{ text.text }}</p>
        {% endfor %}
   </div>
</div>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question