Django Updateview Generic Class
How can I access the object passed by the user inside a generic view class? In template, when the user clicks the link:
Solution 1:
classUpdatePeon(generic.UpdateView):
if item['attr1'] == "Attribute1":
model = model1form= model1Form
else:
...
classUpdatePeon(generic.UpdateView):
defget_form_class(self):
if self.object.pk == 1:
return MyForm
else:
return OtherForm
You may find the ccbv website useful for exploring the update view methods.
Post a Comment for "Django Updateview Generic Class"