class-based-views

Django: Search form in Class Based ListView

本秂侑毒 提交于 2019-11-27 18:11:21
I am trying to realize a Class Based ListView which displays a selection of a table set. If the site is requested the first time, the dataset should be displayed. I would prefer a POST submission, but GET is also fine. That is a problem, which was easy to handle with function based views , however with class based views I have a hard time to get my head around. My problem is that I get a various number of error, which are caused by my limited understanding of the classed based views. I have read various documentations and I understand views for direct query requests, but as soon as I would

Django: Search form in Class Based ListView

自作多情 提交于 2019-11-26 19:12:27
问题 I am trying to realize a Class Based ListView which displays a selection of a table set. If the site is requested the first time, the dataset should be displayed. I would prefer a POST submission, but GET is also fine. That is a problem, which was easy to handle with function based views , however with class based views I have a hard time to get my head around. My problem is that I get a various number of error, which are caused by my limited understanding of the classed based views. I have

How to use permission_required decorators on django class-based views

妖精的绣舞 提交于 2019-11-26 14:02:17
I'm having a bit of trouble understanding how the new CBVs work. My question is this, I need to require login in all the views, and in some of them, specific permissions. In function-based views I do that with @permission_required() and the login_required attribute in the view, but I don't know how to do this on the new views. Is there some section in the django docs explaining this? I didn't found anything. What is wrong in my code? I tried to use the @method_decorator but it replies " TypeError at /spaces/prueba/ _wrapped_view() takes at least 1 argument (0 given) " Here is the code (GPL):

How to use permission_required decorators on django class-based views

て烟熏妆下的殇ゞ 提交于 2019-11-26 12:16:10
问题 I\'m having a bit of trouble understanding how the new CBVs work. My question is this, I need to require login in all the views, and in some of them, specific permissions. In function-based views I do that with @permission_required() and the login_required attribute in the view, but I don\'t know how to do this on the new views. Is there some section in the django docs explaining this? I didn\'t found anything. What is wrong in my code? I tried to use the @method_decorator but it replies \"