url rewriting - How to make a "beautiful" URL with Django-Python -
url rewriting - How to make a "beautiful" URL with Django-Python -
i have url product of form:
/capidahl?fecha=2014-06-23&hora1=00&minutos1=00&hora2=23&minutos2=59
i want create shorter, capidahl/2014/06/24.
how can rewrite url using django?
that done in django. in urls.py, specify handler:
(r'^capidahl/(?p<fecha>[0-9-.]+)/*(?p<hora>[0-9]+)/*(?p<minutos>[0-9]+)', 'my_function')
then, function handles variables:
def my_function(request, fecha, hora='12', minutos='00'):
explained at: https://docs.djangoproject.com/en/dev/topics/http/urls/
django url-rewriting django-forms
Comments
Post a Comment