mirror of
https://github.com/ansible/awx.git
synced 2024-11-01 16:51:11 +03:00
Equate '' to None for foreign key references when PUTing to a job template
The UI will sometimes send an empty string instead of null, we already handle this in our serializer and treat it as null, so this change brings our access system in line with the expectation that those two things should be equal. Possibly related to #3077
This commit is contained in:
parent
5bce9ee215
commit
64d653bc61
@ -978,7 +978,8 @@ class JobTemplateAccess(BaseAccess):
|
||||
|
||||
for k, v in data.items():
|
||||
if hasattr(obj, k) and getattr(obj, k) != v:
|
||||
if k not in field_whitelist and v != getattr(obj, '%s_id' % k, None):
|
||||
if k not in field_whitelist and v != getattr(obj, '%s_id' % k, None) \
|
||||
and not (hasattr(obj, '%s_id' % k) and getattr(obj, '%s_id' % k) is None and v == ''): # Equate '' to None in the case of foreign keys
|
||||
return False
|
||||
return True
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user