@adam we have some overrides: in particular `full_clean` is just setting the values specified in the Form and it will keep the existing at the old values.
```
class APIEditMixin:
"""A mixin that allows sane usage of Django's form machinery via the API.
First it ensures that missing fields are not errors, then it removes
None values from cleaned data. This means that missing fields result
in no change instead of an error.
:ivar submitted_data: The `data` as originally submitted.
"""
```
def full_clean(self):
"""For missing fields, default to the model's existing value.""" self.submitted_data = self.data print("DATA") print(self.data) print(self.initial)
self.data = get_overridden_query_dict( self.initial, self.data, self.fields
) print(self.data) super().full_clean()
```
and executing the test I posted above you will see
@adam we have some overrides: in particular `full_clean` is just setting the values specified in the Form and it will keep the existing at the old values.
```
class APIEditMixin:
"""A mixin that allows sane usage of Django's form machinery via the API.
First it ensures that missing fields are not errors, then it removes
None values from cleaned data. This means that missing fields result
in no change instead of an error.
:ivar submitted_data: The `data` as originally submitted.
"""
def full_clean(self):
self.submitted _data = self.data query_dict(
self. initial, self.data, self.fields
super( ).full_ clean()
"""For missing fields, default to the model's existing value."""
self.data = get_overridden_
)
```
For example, patching it like
```
self.submitted _data = self.data
print( "DATA")
print( self.data)
print( self.initial) query_dict(
self. initial, self.data, self.fields
print( self.data)
super( ).full_ clean()
def full_clean(self):
"""For missing fields, default to the model's existing value."""
self.data = get_overridden_
)
```
and executing the test I posted above you will see
``` LVorz8' , 'domain': 0, 'osystem': 'ubuntu', 'distro_series': 'ubuntu/focal', 'architecture': 'arch-xzgCJi/ sub-sxIylM' , 'min_hwe_kernel': None, 'hwe_kernel': None, 'swap_size': None, 'ephemeral_deploy': False, 'license_key': None, 'install_rackd': False, 'enable_hw_sync': False} TLVorz8' ], 'domain': [0], 'osystem': ['ubuntu'], 'distro_series': ['ubuntu/focal'], 'architecture': ['arch- xzgCJi/ sub-sxIylM' ], 'min_hwe_kernel': [None], 'hwe_kernel': [None], 'swap_size': [None], 'ephemeral_deploy': [False], 'license_key': [None], 'install_rackd': [False], 'enable_hw_sync': [True]}>
# FIRST DEPLOYMENT
self.data: {'enable_hw_sync': True}
self.initial: {'hostname': 'a5NPjpSsMxvbdT
self.data: <QueryDict: {'hostname': ['a5NPjpSsMxvbd
# SECOND DEPLOYMENT
self.data: {} LVorz8' , 'domain': 0, 'osystem': 'ubuntu', 'distro_series': 'ubuntu/focal', 'architecture': 'arch-xzgCJi/ sub-sxIylM' , 'min_hwe_kernel': '', 'hwe_kernel': 'hwe-20.04', 'swap_size': None, 'ephemeral_deploy': False, 'license_key': '', 'install_rackd': False, 'enable_hw_sync': True} TLVorz8' ], 'domain': [0], 'osystem': ['ubuntu'], 'distro_series': ['ubuntu/focal'], 'architecture': ['arch- xzgCJi/ sub-sxIylM' ], 'min_hwe_kernel': [''], 'hwe_kernel': ['hwe-20.04'], 'swap_size': [None], 'ephemeral_deploy': [False], 'license_key': [''], 'install_rackd': [False], 'enable_hw_sync': [True]}>
self.initial: {'hostname': 'a5NPjpSsMxvbdT
self.data: <QueryDict: {'hostname': ['a5NPjpSsMxvbd
```