You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update save to get another method that could be override
def save_instance(self, instance, **data):
record = instance(**data)
record.save(force_update=False)
return record
def save(self, instance=None):
"""
Save all contents
"""
if not instance:
instance = self.Meta.model
if not instance:
raise AttributeError('Invalid instance model')
if self.Meta.transaction:
with transaction.atomic():
for row, data in self.cleaned_data:
_ = self.save_instance(instance=instance, **data)
try:
self.pre_commit()
except Exception as e:
self._error.append(self.get_error_message(e, error_type='__pre_commit__'))
transaction.rollback()
try:
transaction.commit()
except Exception as e:
self._error.append(self.get_error_message(e, error_type='__trasaction__'))
transaction.rollback()
else:
for row, data in self.cleaned_data:
_ = self.save_instance(instance=instance, **data)
self.post_save_all_lines()
return True
The text was updated successfully, but these errors were encountered:
Update save to get another method that could be override
The text was updated successfully, but these errors were encountered: