1

I have a few forms in my forms.py that include redundant fields (username, email...) Im wondering if there is something similar to Django's Model Inheritance (namely, the abstract base style). It would be nice to cut down on redundancy.

1 Answer 1

1

Forms are normal Python classes, and can be subclassed like any other class. There's no need to do anything special to make an abstract base class - that's only necessary with models because a normal model class has a database component. A form can be subclassed just as it is, and in fact I do this regularly in projects for precisely the same reason, to cut down on redundancy.

Sign up to request clarification or add additional context in comments.

1 Comment

"no need to do anything special" meaning I do not have to include the Meta class?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.