Hi all,
I want to change below function to use the generic view function
update_object:
@login_required
def edit_bug_page(request, bug_id = None):
if bug_id == None:
bugInstance = Bug()
else:
bugInstance = get_object_or_404(Bug, pk = bug_id)
members = bugInstance.project.member.order_by('member')
if request.user not in members:
return HttpResponseRedirect('/bug/fail/')
if request.method == 'POST':
form = BugForm(request.POST, instance = bugInstance)
if form.is_valid():
bug = form.save()
return HttpResponseRedirect('/bug/success/')
else:
form = BugForm(instance = bugInstance)
variables = RequestContext(request, {'form': form})
return render_to_response('add_bug.html', variables)
But how to use the update_object function in my views.py? Someone can help
me? Thanks a lot!
--
Deng Chao
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.