Thanks Malcolm.Understood very clearly.

Following the same approach i have used following code in my templates
{% url djorum_feed_url   category.getCategoryString %}

category.getCategoryString is the function which returns category
string "category/catgory.id"


Regards
rama

BUt how should i use the url tag to form the above
Actually i need this url in my template

On Feb 28, 5:10 am, Malcolm Tredinnick <malc...@pointy-stick.com>
wrote:
> On Fri, 2009-02-27 at 01:20 -0800, Rama Vadakattu wrote:
> > i am using django feed syndication framework.
>
> > 1) .in urls.py
>
> >  feeds = {
> >    'category': LatestTopicsByCategory,
> > }
>
> >   urlpatterns += patterns('',
> >                     url(r'^feeds/(?P<url>.*)/$',
> > 'django.contrib.syndication.views.feed' , {'feed_dict':
> > feeds},name='djorum_feed_url') ,
> >                         )
>
> > LatestTopicsByCategory is the class which generates feed for  every
> > category.
>
> > /feeds/category/1 ===========> generates feed for category 1
>
> > -----------------------
>
> > Now i want to make  this feedurl in template based on the categoryid?
> > How do i reverse lookup from the djorum_feed_url (in urls.py) ?
>
> The reverse() function operates solely on things inside the
> "urlpatterns" variable. Which means the arguments you pass to reverse()
> in this case are the view name (djorum_feed_url) and the "url"
> parameter.
>
> To make this a bit more readable in your code, you'll want to create a
> function that takes, say, a category number and returns the correct
> value for the "url" parameter. For example:
>
>         def create_url_param(category_num):
>            return u"category/%d" % category_num
>
> Then you can combine them as:
>
>         reverse("djorum_feed_url", kwargs={"url": create_url_param(1)})
>
> or create a wrapper function for all of that.
>
> If it were me, I might be tempted to make create_url_param() a method on
> the LatestTopicsByCategory class. I'd probably think of a better name,
> though. Even as I type this email, I'm getting sick of reading
> create_url_param().
>
> Regards,
> Malcolm
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to