mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Data must be copied in a particular way
This commit is contained in:
parent
44ab487b62
commit
dcc8acb49a
@ -10,6 +10,8 @@ import os
|
||||
|
||||
from decimal import Decimal
|
||||
|
||||
from collections import OrderedDict
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import User
|
||||
from django.core.exceptions import ValidationError as DjangoValidationError
|
||||
@ -95,6 +97,14 @@ class InvenTreeModelSerializer(serializers.ModelSerializer):
|
||||
# If instance is None, we are creating a new instance
|
||||
if instance is None and data is not empty:
|
||||
|
||||
if data is None:
|
||||
data = OrderedDict()
|
||||
else:
|
||||
new_data = OrderedDict()
|
||||
new_data.update(data)
|
||||
|
||||
data = new_data
|
||||
|
||||
# Add missing fields which have default values
|
||||
ModelClass = self.Meta.model
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user