Remove "id" field during create

2019-08-17
Marnanel Thurman 2019-06-17 20:45:47 +01:00
rodzic f73e8dfbd1
commit 0ee6e2970f
1 zmienionych plików z 7 dodań i 2 usunięć

Wyświetl plik

@ -368,8 +368,13 @@ class Thing(models.Model):
value['type'] = value['type'].title()
if 'id' not in value and sender is not None:
raise ValueError("Remote things must have an id")
if 'id' in value:
if sender is None:
logger.warn('Removing "id" field at Thing creation')
del value['id']
else:
if sender is not None:
raise ValueError("Remote things must have an id")
record_fields = {
'active': True,