#21893: Migrations RunPython operations seem to trip on MTI models.
----------------------------+-------------------------
     Reporter:  loic84      |      Owner:
         Type:  Bug         |     Status:  new
    Component:  Migrations  |    Version:  1.7-alpha-1
     Severity:  Normal      |   Keywords:
 Triage Stage:  Unreviewed  |  Has patch:  0
Easy pickings:  0           |      UI/UX:  0
----------------------------+-------------------------
 The attached tests demonstrate 2 issues:

 - The pk isn't assigned after a call to `objects.create()`, although I can
 confirm that the object is properly created.

 {{{
 pony = ShetlandPony.objects.create()
 self.assertIsNot(pony.pk, None)
 }}}

 - `objects.create()` doesn't accept any arguments that refer to
 superclasses' fields:

 {{{
 >>> pony = ShetlandPony.objects.create(weight=5)
 Traceback (most recent call last):
   File "/Users/loic/Dev/django/tests/migrations/test_operations.py", line
 544, in test_run_python
     operation.database_forwards("test_runpython", editor, project_state,
 new_state)
   File
 "/Users/loic/Dev/django/django/db/migrations/operations/special.py", line
 141, in database_forwards
     self.code(models=from_state.render(), schema_editor=schema_editor)
   File "/Users/loic/Dev/django/tests/migrations/test_operations.py", line
 538, in create_shetlandponies
     pony2 = ShetlandPony.objects.create(weight=5)
   File "/Users/loic/Dev/django/django/db/models/manager.py", line 92, in
 manager_method
     return getattr(self.get_queryset(), name)(*args, **kwargs)
   File "/Users/loic/Dev/django/django/db/models/query.py", line 364, in
 create
     obj = self.model(**kwargs)
   File "/Users/loic/Dev/django/django/db/models/base.py", line 465, in
 __init__
     raise TypeError("'%s' is an invalid keyword argument for this
 function" % list(kwargs)[0])
 TypeError: 'weight' is an invalid keyword argument for this function
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/21893>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/049.9ee439b95def19da9399795fb2ac1b57%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to