python - Render django application within TextField -
I am creating an application to display articles. In my model, I have a TextField that contains the content of the article.
Now I would like to be able to present another application within my article. Suppose I have a voting application and I want to display a poll in the middle of the article. How can I go about doing this?
I tried putting a Should I make some type tag (such as called You can make TextField string as a template. Ie .: Django.db import import template from template from django.db import template, context menu YourModel (models.Model): body = models.TextField () def render_body (self, reference = none): templates = templates (self .body) reference = context or {} context ['object'] = self return template. Render (reference (reference)) Then in the actual template, you {% render_poll 42%} inside the post, but as expected, it only displays that page.
[poll = 42] ) and parse it before displaying the html page? (I use the library, maybe I can increase it.) How can I do this to stay in a good "dijgo friendly" way? I want to, when in the admin panel, I easily insert the choice (or other app) within an article.
{{your_model.render_body}} instead of
{{your_model.body}} .
Comments
Post a Comment