I can test this right now but based in my experience in re I think could be like this
url(r'^(?P<location_alias>[a-zA-Z0-9_\-]+)/(?P<category_alias>[a-zA-Z0-9_\-]+)/(?P<properties>([a-zA-Z0-9_\-]+)/){7})$', views.item_list) Be worry with / in views El viernes, 3 de junio de 2016, Горобец Дмитрий <dmitr...@gmail.com> escribió: > 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. > -- "La utopía sirve para caminar" Fernando Birri -- 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/CAG%2B5VyNpneVSXBhz3FN%3DmmuOL%2Bcoe6Z4s0p-kh4B1B0M1P_B6w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.