On Thu, 2009-01-29 at 21:31 -0800, vierda wrote:
> Dear all,
> Thanks for your reply I have modified my code as per below :
> 
> views.py :
[...]
> def delete (request):
>    user = request.user
>    if user.is_superuser:
>       if request.method == 'POST':
>          form = DeleteForm(request.POST)
>          if form.is_valid:
>             username = form.cleaned_data['username']
>             user_delete = User.objects.get(username=username)
>             id_delete = user_delete.id
>             return delete_object(request,object_id = id_delete,
> model=User, post_delete_redirect='/notify/success/',
> template_name='delete.html',login_required=True)
>       else :
>          form = DeleteForm()
>       variables = RequestContext(request, {'form' : form})
>       return render_to_response('delete.html',variables)

[...]
> the display_delete_profile run fine and exactly like I want, but
> delete always raise error "The view
> fintoo.apps.authorization.views.delete didn't return an HttpResponse
> object."
> I have google it and by example provided it relate to indentation
> matters when put template renderer. but I think I don't have any
> problem with that. please put some light and really appreciate for any
> kind help. Thank you.

It is kind of an indentation thing. Basically, every possible way of
leaving the view function has to return an HttpResponse (which is what
render_to_response() returns).

Have a look at your view and notice what happens when user.is_superuser
is False. The code falls off the bottom of the function, which
implicitly returns None. You need to return something in that situation
as well.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to