regex - Django urls conf -


so worked django bit , understand regex rudimentary.

i know if there request "maps"(not sure means) urls definition in view.

that clear , understandable 1 page. if want design urlpattern multiple pages and/or whole website. dont understand part.

is there way without regex? if not: way create robust structure regex? can add , remove pages quickly.

how flatpages differ form other pages in regard?

if possible , reasonable achieve following urls.py?

  1. flatpages usual sites website needs:

home media . . . contacts

  1. dynamically created sites within that similar webgallery (but not)

where on first site have text , checkboxes. , have 1 item of media on every page next button.

urls this

myapp/start/

and then

myapp/start/1 n

and myapp/ in main navigation , flatpage.

i used static pages , somehow dont understand how can structure these different pages. seems flatpages static. can work easier them. maybe later run problems using approach.

if there great way understand regexes or how create site structure in django: please tell me.

thanks!!

in urls.py, not mapping url page, mapping url function can render page. can map multiple urls same function, , can have function return different things based on url, if wanted.

so, case, might have looks like

(r'^myapp/$', 'myapp.show_main_navigtaion_page'), # if url "myapp/" only, show main nav (r'^articles/start/$', 'myapp.show_start_page'), (r'^articles/start/(\d+)/$', 'myapp.do_something_with_start'), 

some basic regex stuff in here: "^" character means start of url, "$" means end of string, "()" characters capture whatever inside them, "\d+" matches 1 or more numbers.


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -