Seeding Foreign Key with known object with Class Based Views
I have two tables, Client and Address. Address has a foreign key 'client' which points to the client table. I'll make my user enter a client and then enter 1-x Addresses. I'll know which client the address is being linked to before the record is created, with a url like : /client/3/address/new/.
I want to seed the client id programmatically without presenting a form field to enter what's a known value.
I've got this working with method based views, (just throw the client id in a hidden field. easy peasy) but can't find an example for what seems to me to be a real common need using class based views.
The closest I've found are examples relating a user to an object, but this isn't quite that and I've spent a fair amount of time trying to adapt the example and either the form complains because the client field is missing or there's some other problem.
Sooo, I'm hoping that there's an existing example/blog post/stackoverflow question that I've missed that someone could point me to that demonstrates this process.
Thanks and happy thanksgiving for us US residents. I'll be thankful for the non-US folk who might be working and would care to take a shot at this.
-- You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home