Hello,
 
I'm wondering how you would you organize the url layout in a following 
scenario
 
Suppose I've a table of Authors and for each author a list of books.
A book can have only one author, so I link the author with a foreign key.
 
Now I could point to a particular author with a url like this (to show the 
details)
 
/mylibrary/author/32
 
I wish to put a button to add a new book and would like the CreateView 
derived class handling the request to collect the author id (32 in this 
case) so my form would automatically set the foreign key and make it 
unchangeable from the client browser.
 
Now the questions are:
 
1) would you oranize the url in a way like this?   (notice that 32 is the 
author id)
/mylibrary/book/32/addnewbook
 
2) how do I extract the slug within my BookNew (derived from CreateNew)?
url(r'^book/(?P<slug>\d+)/addnewbook, BookNew.as_view()),
 
seems not avaliable as in the context/template: {{ slug }}
 
Cheers,
Giulio.
 
 
 

-- 
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/dd239b7e-a0fd-46ba-8558-4e5ef75c2f75%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to