Re: Generic View update_object with foreign key.
-- Sent from my Palm Unknown
Bvgfgf
DavodM wrote:
Hello all,
Im just getting started with Django so apologies if this is a silly
question.
I have worked through the 4 tutorials and built the Poll application.
I am now trying to add a page to edit polls using a generic view. My
aim is to be able to edit polls in the same way as in the admin view,
i.e editing the question and the foreign keyed choices.
I have managed to implement the generic update_object and can happily
edit the main data for the poll but am getting stuck with editing the
foreign key values.
From reading the documentation I think I need to pass 'form_class' :
MyPollForm instead of 'model' : Poll. Where MyPollForm is a model form
for poll with an inline formset for choices.
<pre>
class ChoiceInline(???):
class Meta:
model = Choice
class MyPollForm(ModelForm):
class Meta:
model = Poll
</pre>
Am I going about this the right way? If so what does choice inline
need to inherit from and how do I add it to MyPollForm?
Thanks in advance,
Dave
--~--~---------~--~----~------------~-------~--~----~
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