M
M
MrDoSSSS2017-09-24 22:20:15
Django
MrDoSSSS, 2017-09-24 22:20:15

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

1 answer(s)
B
bi4ara, 2017-09-28
@bi4ara

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 question

Ask a Question

731 491 924 answers to any question