mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Fix for form rendering of "required" fields with a default value
- Force the "required" parameter to be set
This commit is contained in:
parent
004b36b1df
commit
13ca076f42
@ -153,6 +153,11 @@ class InvenTreeMetadata(SimpleMetadata):
|
||||
if 'default' not in field_info and not field.default == empty:
|
||||
field_info['default'] = field.get_default()
|
||||
|
||||
# Force non-nullable fields to read as "required"
|
||||
# (even if there is a default value!)
|
||||
if not field.allow_null and not (hasattr(field, 'allow_blank') and field.allow_blank):
|
||||
field_info['required'] = True
|
||||
|
||||
# Introspect writable related fields
|
||||
if field_info['type'] == 'field' and not field_info['read_only']:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user