Re: login_required and new class based views

2010-10-23 Thread Łukasz Rekucki
On 23 October 2010 08:08, Joachim Pileborg wrote: > > On 19 Okt, 21:18, Łukasz Rekucki wrote: >> On 19 October 2010 19:06, Valentin Golev wrote:> Hello, >> > I was going to write something like LoginRequiredMixin, but I have no >> > idea how to do this. I need to run my code before .dispatch(),

Re: login_required and new class based views

2010-10-23 Thread Joachim Pileborg
On 19 Okt, 21:18, Łukasz Rekucki wrote: > On 19 October 2010 19:06, Valentin Golev wrote:> Hello, > > I was going to write something like LoginRequiredMixin, but I have no > > idea how to do this. I need to run my code before .dispatch(), but I > > also have to call the old dispatch, but since M

Re: login_required and new class based views

2010-10-20 Thread Harro
Let me add that the decorator_from_middleware call all the middleware process_* functions if available but these will ofcourse be called at a whole different point in time then the actual middleware. Normally middleware is woven through the whole dispatch process, as a decorator it's wrapped around

Re: login_required and new class based views

2010-10-20 Thread Russell Keith-Magee
2010/10/20 Łukasz Rekucki : > On 19 October 2010 19:06, Valentin Golev wrote: >> Hello, >> > 2) decorate the dispatch method. You need to turn login_required into > a method decorator first (Django should probably provide a tool for > this). Django does :-) It's called method_decorator. from dja

Re: login_required and new class based views

2010-10-19 Thread Valentin Golev
Thank you, I didn't know that! -- Best Regards, Valentin Golev Lead Developer r00, http://r00.ru http://valyagolev.net +7 921 789 0895, avaiable 12:00-18:00 MSK 2010/10/19 Łukasz Rekucki : > On 19 October 2010 21:21, Valentin Golev wrote: >> Thank you! >> >> Does python's super really works t

Re: login_required and new class based views

2010-10-19 Thread Łukasz Rekucki
On 19 October 2010 21:21, Valentin Golev wrote: > Thank you! > > Does python's super really works the way like in the last option? Yes, it should call dispatch() from the next class in MRO. So if you place it at the start, like this: class MyView(LoginRequiredMixin, TemplateView): pass It sho

Re: login_required and new class based views

2010-10-19 Thread Valentin Golev
Thank you! Does python's super really works the way like in the last option? -- Best Regards, Valentin Golev Lead Developer r00, http://r00.ru http://valyagolev.net +7 921 789 0895, avaiable 12:00-18:00 MSK 2010/10/19 Łukasz Rekucki : > On 19 October 2010 19:06, Valentin Golev wrote: >> Hell

Re: login_required and new class based views

2010-10-19 Thread Łukasz Rekucki
On 19 October 2010 19:06, Valentin Golev wrote: > Hello, > > I'm trying to start using new class based views from the trunk. > > I need to rewrite a view which is decorated > django.contrib.auth.decorators.login_required. > > How should I go with that? There are couple of options. 1) decorate the

login_required and new class based views

2010-10-19 Thread Valentin Golev
Hello, I'm trying to start using new class based views from the trunk. I need to rewrite a view which is decorated django.contrib.auth.decorators.login_required. How should I go with that? I was going to write something like LoginRequiredMixin, but I have no idea how to do this. I need to run m