Re: Is there a way to automatically assign URLs based on view names?
On Sat, Jul 6, 2013 at 3:48 AM, R. Eastbourne <rex.eastbourne@gmail.com> wrote:
> I would like these URLs assigned automatically.
i've done this once. crude, but works ok:
------ at the end of urls.py ------
def _simpleurl(viewname, mod):
return url ('^%s/$'%viewname, getattr(mod, viewname), name=viewname)
urlpatterns += patterns ('', *(_simpleurl(vn,views) for vn in
views.simpleviews))
---------------------------
where views.simpleviews is a list of function names defined in views.py.
--
Javier
--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home