Re: A.objects.getdefault

2013-01-26 Thread Mike Fogel
+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

Re: Class based views: A standard hook for http-method-independent code

2012-11-20 Thread Mike Fogel
+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

Re: Class based views: A standard hook for http-method-independent code

2012-11-07 Thread Mike Fogel
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

Re: Class based views: A standard hook for http-method-independent code

2012-03-16 Thread Mike Fogel
> 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: