When editing an object using ModelForm, the best way I know is def my_view(request): obj_id = request.POST.get('obj_id', '') old_object = MyModel.objects.get(pk=obj_id) form = MyModelForm(request.POST, instance=old_object) ...
but I'm thinking the first two lines are a pain to write every time. Is it possible to do it all in one line? Something like where MyModelForm is smart enough to put it's own hidden field in the html to store the pk, and then when loading check the request.POST to see if the hidden field contains a pk so it can know if it should be an instance or not. in short, is there a better way to do this, or am I using the best Django's got? hope I make sense...
-- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.