1👍
Well, you have to set your required fields somewhere. If you don’t want them to be shown or editable in the form, your options are to set them in the view (by using a custom subclass of CreateView
) or if appropriate to your design in the save
method of the model class. Or declare an appropriate default
value on the field in the model.
It would also work to allow the fields into the form, but set them to use HiddenInput
widgets. That’s not safe against malicious input, so I wouldn’t do that for purely automated fields.
0👍
You cannot exclude fields, which are set as required in the model definition. You need to define blank=True
/null=True
for each of these model fields.
If this doesn’t solve your issue, then please show us the model and form definitions, so we know exactly what the code looks like.
- [Answer]-Django crispy forms – VariableDoesNotExist
- [Answer]-Python / django's module / class theory: Template object under django.template.base.Template
- [Answer]-Python django class based view and functional view
- [Answer]-Django Haystack search in Html