There is a default get_object() method in the SingleObjectMixin that just gets the object based on the "model" and the "pk" that's passed in:
https://code.djangoproject.com/browser/django/trunk/django/views/generic/detail.py#L19
If you need different functionality, you can overwrite that method. But otherwise, there's no need. In your case, you could write it like this:
def get_object(self):
return Response.get(pk=self.kwargs.get('pk'))
But since that's what the default get_object() already does, there's no need for you to specify either "object" or "get_object()"
-- You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/IthGAEQnBMMJ.
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.
No comments:
Post a Comment