Answer the question
In order to leave comments, you need to log in
How to make requests have different fields for filling in for each category of services?
Good day. There was a need to make sure that different types of services have different fields for filling out applications for the provision of these same services. What are the ways to do this, excluding the creation of models for each category. Is there any universal way? I'm using Django 1.11
Answer the question
In order to leave comments, you need to log in
for example:
you have a model with types of services, it has some signs that distinguish which fields to show.
You create a form for editing a service. In the form:
1) at init, depending on the conditions, prefill the necessary fields, set required = true
2) at is_valid: check complex filling conditions
in the template, depending on the conditions, display only the necessary fields
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question