django dynamic template tag

64 views
Skip to first unread message

Fadi Samara

unread,
Jul 2, 2013, 8:11:08 PM7/2/13
to django...@googlegroups.com

I try to build a plugins based application, I have created tags and registered them for each plugin.

I have a table stores each page plugins, and need to render any stored plugin in the template accordingly as inclusion tag.

Now for the template i use this:

{% block slider_region %}
{% for pagecontent in pagecontents %}
    {% pagecontent.plugin %}
{% endfor %}
{% endblock %}

But this returns:

Invalid block tag: 'pagecontent.plugin', expected 'empty' or 'endfor'

My question, how can I pass the plugin as a tag from view query to a template and be rendered as inclusion tag.

Fred Stluka

unread,
Jul 3, 2013, 9:00:31 AM7/3/13
to django...@googlegroups.com
Fadi,

You need to {% load %} the file that defines the tags.

--Fred
Fred Stluka -- mailto:fr...@bristle.com -- http://bristle.com/~fred/
Bristle Software, Inc -- http://bristle.com -- Glad to be of service!
Open Source: Without walls and fences, we need no Windows or Gates.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Fadi Samara

unread,
Jul 3, 2013, 9:06:44 PM7/3/13
to django...@googlegroups.com
its already included at the start of the template to load all plugin tags {% load slider ...%}


Regards,
Fadi Samara.


--
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/AukAEPmgq_A/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.

Fadi Samara

unread,
Jul 3, 2013, 9:08:27 PM7/3/13
to django...@googlegroups.com
Hi Fred,


its already included at the start of the template to load all plugin tags {% load slider ...%}

Thanks,



On Wednesday, July 3, 2013 11:00:31 PM UTC+10, Fred Stluka wrote:
Fadi,

You need to {% load %} the file that defines the tags.

Andriyko

unread,
Jul 13, 2013, 3:19:54 PM7/13/13
to django...@googlegroups.com

Try {{ pagecontent.plugin }} instead of {% pagecontent.plugin %}
Reply all
Reply to author
Forward
0 new messages