+1 to replacing earliest() and latest() with order_by('field').first() and
.last(), respectively. I'm not a fan of the implied semantics of 'earliest'
and 'latest' - as if they only worked with time-based fields.
Mike
On Tuesday, January 22, 2013 3:03:22 PM UTC-8, Wim Feijen wrote:
>
> Hi Selwi
+1, this allows me what I want - to have http method-independent code that
uses self.args, self.kwargs and self.request.
On Sunday, November 18, 2012 1:52:07 PM UTC-8, Jordan Hagan wrote:
>
> +1, this looks like a better solution than the hook method.
>
> On Sat, Nov 17, 2012 at 7:52 AM, Jeremy D
I prefer django-rest-framework's flow through dispatch(). You can override
self.initial() to safely execute method-agnostic logic, but unlike your
example, it doesn't have to return a response object. The response object
is returned by the appropriate self.() as usual.
https://github.com/tomchr
> I don't really see what difference another function makes.
> Sayhttps://gist.github.com/1957251is implemented, what makes:
>
> def prepare_view(self, request, *args, **kwargs):
> # the thing I want to do
> super(ClassName, self).prepare_view(request, *args, **kwargs)
>
> preferable over: