-
-
Notifications
You must be signed in to change notification settings - Fork 370
Open
Description
Problem
If a tracked model has the instance field, creating a instance of the model throws
TypeError: Model.__init__() got multiple values for argument 'instance'
Environment
- Django Model Utils version: 5.0.0
- Django version: any
- Python version: any
- Other libraries used, if any: none
Code examples
class SomeModel(models.Model):
name = models.CharField(max_length=100)
instance = models.CharField(max_length=100)
model = SomeModel.objects.create(name="test", instance="12.34")
Error
Traceback (most recent call last):
File "<projectdir>/env/lib/python3.11/site-packages/django/test/utils.py", line 446, in inner
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "<projectdir>/tests/testapp/tests/test_model.py", line 273, in test_model_with_instance_property
model = SomeModel.objects.create(name="test", instance="test")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<projectdir>/env/lib/python3.11/site-packages/django/db/models/manager.py", line 87, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<projectdir>/env/lib/python3.11/site-packages/django/db/models/query.py", line 677, in create
obj = self.model(**kwargs)
^^^^^^^^^^^^^^^^^^^^
TypeError: Model.__init__() got multiple values for argument 'instance'
Metadata
Metadata
Assignees
Labels
No labels