Hello, guys.

I have the following URL patterns in my urls.py module and I'd like to 
refactor them:

url(r'^(?P<location_alias>[a-zA-Z0-9_\-]+)/(?P<category_alias>[a-zA-Z0-9_\-]+)/$',
 views.item_list, name="item_location_category"),
url(r'^(?P<location_alias>[a-zA-Z0-9_\-]+)/(?P<category_alias>[a-zA-Z0-9_\-]+)/(?P<property_one>[a-zA-Z0-9_\-]+)/$',
 views.item_list),
url(r'^(?P<location_alias>[a-zA-Z0-9_\-]+)/(?P<category_alias>[a-zA-Z0-9_\-]+)/(?P<property_one>[a-zA-Z0-9_\-]+)/(?P<property_two>[a-zA-Z0-9_\-]+)/$',
 views.item_list),
url(r'^(?P<location_alias>[a-zA-Z0-9_\-]+)/(?P<category_alias>[a-zA-Z0-9_\-]+)/(?P<property_one>[a-zA-Z0-9_\-]+)/(?P<property_two>[a-zA-Z0-9_\-]+)/(?P<property_three>[a-zA-Z0-9_\-]+)/$',
 views.item_list),
url(r'^(?P<location_alias>[a-zA-Z0-9_\-]+)/(?P<category_alias>[a-zA-Z0-9_\-]+)/(?P<property_one>[a-zA-Z0-9_\-]+)/(?P<property_two>[a-zA-Z0-9_\-]+)/(?P<property_three>[a-zA-Z0-9_\-]+)/(?P<property_four>[a-zA-Z0-9_\-]+)/$',
 views.item_list),
url(r'^(?P<location_alias>[a-zA-Z0-9_\-]+)/(?P<category_alias>[a-zA-Z0-9_\-]+)/(?P<property_one>[a-zA-Z0-9_\-]+)/(?P<property_two>[a-zA-Z0-9_\-]+)/(?P<property_three>[a-zA-Z0-9_\-]+)/(?P<property_four>[a-zA-Z0-9_\-]+)/(?P<property_five>[a-zA-Z0-9_\-]+)/$',
 views.item_list),
url(r'^(?P<location_alias>[a-zA-Z0-9_\-]+)/(?P<category_alias>[a-zA-Z0-9_\-]+)/(?P<property_one>[a-zA-Z0-9_\-]+)/(?P<property_two>[a-zA-Z0-9_\-]+)/(?P<property_three>[a-zA-Z0-9_\-]+)/(?P<property_four>[a-zA-Z0-9_\-]+)/(?P<property_five>[a-zA-Z0-9_\-]+)/$',
 views.item_list),
url(r'^(?P<location_alias>[a-zA-Z0-9_\-]+)/(?P<category_alias>[a-zA-Z0-9_\-]+)/(?P<property_one>[a-zA-Z0-9_\-]+)/(?P<property_two>[a-zA-Z0-9_\-]+)/(?P<property_three>[a-zA-Z0-9_\-]+)/(?P<property_four>[a-zA-Z0-9_\-]+)/(?P<property_five>[a-zA-Z0-9_\-]+)/(?P<property_six>[a-zA-Z0-9_\-]+)/$',
 views.item_list),
url(r'^(?P<location_alias>[a-zA-Z0-9_\-]+)/(?P<category_alias>[a-zA-Z0-9_\-]+)/(?P<property_one>[a-zA-Z0-9_\-]+)/(?P<property_two>[a-zA-Z0-9_\-]+)/(?P<property_three>[a-zA-Z0-9_\-]+)/(?P<property_four>[a-zA-Z0-9_\-]+)/(?P<property_five>[a-zA-Z0-9_\-]+)/(?P<property_six>[a-zA-Z0-9_\-]+)/(?P<property_seven>[a-zA-Z0-9_\-]+)/$',
 views.item_list)


Example:

http://mysite.com/london/cars/

http://mysite.com/london/cars/new/

http://mysite.com/london/cars/new/audi/

http://mysite.com/london/cars/new/audi/a4/

http://mysite.com/london/cars/new/audi/a4/2016/

http://mysite.com/london/cars/new/audi/a4/2016/white/ etc...


And it shouldn't be query parameter.


Does anyone have any suggestions?


Thank you.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/123e209e-3921-4399-affc-be8b4c67c6d9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
  • URL design Горобец Дмитрий

Reply via email to