yeah, you are right, now I see it too…I shouldn't start reading django docs at the end of a working day… cheers and thanks again!
On Feb 28, 2013, at 9:09 PM, Tomas Neme wrote: > your view class is.. well, that, just a class. > > Every time you use it in an urlpattern, calling .as_view() a new > instance object of that class is created. So the "per instance" should > be pretty much self explanatory > > On Thu, Feb 28, 2013 at 5:04 PM, Ivo Brodien <i...@brodien.de> wrote: >> Thanks Tomas, >> >> now I got it! Still the original usage of "per" and "every" sounds strange >> to me.. it should be more like "per instance within a URL pattern", but I am >> not a native in English, so nevermind. >> >> Thanks! >> >> On Feb 28, 2013, at 8:54 PM, Tomas Neme wrote: >> >>>> This approach applies the decorator on a per-instance basis. If you want >>>> every instance of a view to be decorated, you need to take a different >>>> approach. >>> >>> This means that with "this approach" you have to apply the decorator >>> in every instance you want modified, that is, every time you have this >>> >>> url(<pattern>, YourView.as_view(),...) >>> >>> and want it decorated, you need to wrap it, individually, like >>> >>> url(<pattern>, decorator(YourView.as_view()), ....) >>> >>> and if you want to define the entire view as decorated, so you don't >>> need to decorate it every time you use it in an urlpattern, because it >>> ALWAYS needs, e.g., to be login_required, you'll need to take a >>> different approach. >>> >>> With function views, this was the normal case, because you did >>> >>> @decorator >>> def my_view(request, *args, **kwargs): >>> ...... >>> >>> and you didn't need to add anything in the urls, with class-based >>> views, you need to do this: >>> https://docs.djangoproject.com/en/1.5/topics/class-based-views/intro/#decorating-the-class >>> >>> >>> -- >>> "The whole of Japan is pure invention. There is no such country, there >>> are no such people" --Oscar Wilde >>> >>> |_|0|_| >>> |_|_|0| >>> |0|0|0| >>> >>> (\__/) >>> (='.'=)This is Bunny. Copy and paste bunny >>> (")_(") to help him gain world domination. >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Django users" group. >>> To unsubscribe from this group and stop receiving emails from it, send an >>> email to django-users+unsubscr...@googlegroups.com. >>> To post to this group, send email to django-users@googlegroups.com. >>> Visit this group at http://groups.google.com/group/django-users?hl=en. >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to django-users+unsubscr...@googlegroups.com. >> To post to this group, send email to django-users@googlegroups.com. >> Visit this group at http://groups.google.com/group/django-users?hl=en. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> > > > > -- > "The whole of Japan is pure invention. There is no such country, there > are no such people" --Oscar Wilde > > |_|0|_| > |_|_|0| > |0|0|0| > > (\__/) > (='.'=)This is Bunny. Copy and paste bunny > (")_(") to help him gain world domination. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.