Prometeo
Prometeo

Reputation: 43

Is it posible to change django form_class dynamically in view class?

In my django app I need to have a different form for the different user role groups; I mean, at least two different forms. Is there any possible way to do so ?

Thanks in advance everyone.

Upvotes: 0

Views: 264

Answers (1)

Daniel Roseman
Daniel Roseman

Reputation: 599530

I presume you are using a class-based view. All the creation/editing views are based on ModelFormMixin, which includes a get_form_class() method.

Upvotes: 2

Related Questions