Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1046969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:13:51+00:00 2026-05-16T16:13:51+00:00

I am outputting content from my models to my templates, however some model fields

  • 0

I am outputting content from my models to my templates, however some model fields call data stored in other models. This happens only in a few fields. I am wondering whether using an if tag to evaluate this would be more efficient compared to storing the django tags inside the models.

Answers to this question say that storing django tags in models is a bad idea without giving reasons (although I think one of the reasons may be someone else may inject some tags in the Database). Assuming that database injection is a rarity, is there a way of escaping Django tags and filters stored in a model.

Or better yet, what would be the most efficient method to handle the above situation where one model field in several fields calls fields stored in another model.

Example:

This should be stored in my models

<p>We focus on:</p>
{% for item in services %}
{% url service_view item.id as service_url %}
<ul>
<li><a href="service_url">{{item.title}}</a></li>
</ul>
{% endfor %}

Outputting it should result in django parsing the relevant django tags as if part of the template

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T16:13:51+00:00Added an answer on May 16, 2026 at 4:13 pm

    Thanks Ned, I tried implementing that but I found it to be quite complex and its also disadvantageous in terms of portability.

    However, I found exactly what I needed at Django Snippets (dont know why I didn’t look there first). Its a quite useful utility known as render_as_template.

    After setting it up as a custom tag, all that I needed was to use it in the form {% render_as_template about_view.content %} and the tags in the models were rendered as models.

    Instructions on creating your own custom templates and tags available here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We're exporting some data from a website app into an Excel spreadsheet, however, when
I am outputting RTF from a word processor component. This is working well, but
I have a repeater control outputting some HTML. I want a table which outputs
I am creating a series of arrays from template tags in a content management
I am using the Radius Tag System (from the RadiantCMS) for a content engine
I am trying to find the best practice for generating and outputting html which
I have a small program to order and sort email messages, outputting to a
Is there a way to create an html link using h:outputLink, other JSF tag
Note: I'm using Zend Framework, but I think most of this applies to PHP
Embedded custom-tag in dynamic content (nested tag) not rendering. I have a page that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.