Sunday, August 19, 2012

Re: Redirect to page with query string

On 19-8-2012 3:29, Barry Morrison wrote:
> I apologize, I'm new to Django and Python...I've tried every which way I
> know how based on what you described, and I can't find success.
>
> Here is what I'm at right now:
>
> http://dpaste.org/7JcGT/
>
> I get this error: 'DeleteCommunityImages' object has no attribute 'GET'

Because the first parameter on an object method is the object:
def get_success_url(self) :
return self.request.GET['return_to']

On class-based views several things are assigned to the object as
attributes and the request object is one of them:
<https://docs.djangoproject.com/en/1.4/topics/class-based-views/#dynamic-filtering>

It probably should be documented better what is available on the view
object and 1.5 docs are improving a lot:
<https://docs.djangoproject.com/en/dev//ref/class-based-views/#specification>

(allthough it still doesn't mention request specifically)

<https://docs.djangoproject.com/en/dev//ref/class-based-views/generic-editing/#deleteview>
Here you see it uses the DeletionMixin:

<https://docs.djangoproject.com/en/dev//ref/class-based-views/mixins-editing/#django.views.generic.edit.DeletionMixin>
and the method signature for get_success_url()

--
Melvyn Sopacua

--
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


Real Estate