On Sat, Jul 21, 2012 at 7:44 PM, Masud Khokhar <masud.khokhar@gmail.com> wrote:
> Hi Russell,
>
> Many thanks for your reply. The template tag approach looks good and I will
> try to use this one.
>
> One further question. If I am using the @register.simple_tag decorator, can
> I create the view in the views.py file or do I have to create a templatetags
> directory and follow the full procedure of creating a tag?
Yes, you need to create a directory named templatetags, and put your
tag library in a module inside that directory. When Django looks
parses your template and find the {% load mytaglibrary %} declaration
(which is what tells it to load the tag) it looks for a directory
named templatetag in each of apps in your project. If you don't put
your tag in the right place, Django won't be able to find your custom
tag.
> Sorry if this sounds all basic but I am quite new to this.
No worries -- everyone has to start somewhere :-)
Yours,
Russ Magee %-)
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment