11
votes
2answers
5k views

Example of Django Class-Based DeleteView

Does anyone know of or can anyone please produce a simple example of Django's class-based generic DeleteView? I want to subclass DeleteView and ensure that the currently logged-in user has ownership ...
9
votes
1answer
3k views

Multiple form classes in django generic (class) views

I'd like to use the class based generic views of django 1.3 for forms, but sometimes have to manage multiple form classes in one form. However, it looks like the existing views based on FormMixin ...
25
votes
4answers
6k views

How to use permission_required decorators on django class-based views

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 ...
3
votes
2answers
3k views

How to subclass django's generic CreateView with initial data?

I'm trying to create a dialog which uses jquery's .load() function to slurp in a rendered django form. The .load function is passed the pk of the "alert" object. Also available in the class functions ...
4
votes
1answer
5k views

How to do a DetailView in django 1.3?

I'm currently learning how to use the class-based views in django 1.3. I'm trying to update an application to use them, but I still don't uderstand very well how they work (and I read the entire ...
1
vote
1answer
769 views

Converting a function based view to a class based view with only a form and no model (object)

Right now, this is how the password is changed within a user profile. What is the best way of converting this to a class based view knowing that there is no model involved? This is the view for ...
3
votes
1answer
275 views

How does the order of mixins affect the derived class?

Say, I have the following mixins that overlaps with each other by touching dispatch(): class FooMixin(object): def dispatch(self, *args, **kwargs): # perform check A ... ...
2
votes
1answer
32 views

django run another class-based view (CBV) in a CBV?

so I have a CBV (A), CBV (B), and a url like regex=r'^(?P<slug>[-\w]+)/(?P<app>[-\w]+)' I want to read in the slug and app parameters with (A) and then based on those, redirect it to an ...
0
votes
4answers
136 views

django class based view returns empty string when POST

To demostrate: from django.views.generic.base import View from django.views.decorators.csrf import csrf_exempt from django.utils.decorators import method_decorator class TestView(View): ...