﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
23296	Invalid parameter to create() in RunPython example	Areski Belaid	Areski Belaid	"Following RunPython documentation: https://docs.djangoproject.com/en/dev/ref/migration-operations/#runpython

I noticed that I could not get the example running if I use argument '''using=db_alias'''.

It raises the following error:
{{{
  File ""../../django/django/db/models/base.py"", line 457, in Model.__init__
    self = <ComplexModel: ComplexModel object>
    *args = ()
    **kwargs = {'using': 'default'}
    455             pass
    456     if kwargs:
--> 457         raise TypeError(""'%s' is an invalid keyword argument for this function"" % list(kwargs)[0])
                args_len = 0
                field = <django.db.models.fields.CharField: name>
                fields_iter = <listiterator object at 0x2ab5a50>
                is_related_object = False
                prop = 'using'
                val = u'name1'
    458 super(Model, self).__init__()
    459 signals.post_init.send(sender=self.__class__, instance=self)
TypeError: 'using' is an invalid keyword argument for this function

}}}


Nevertheless if I remove '''using=db_alias''' it works fine, replacing:
{{{
    db_alias = schema_editor.connection.alias
    Country.objects.create(name=""USA"", code=""us"", using=db_alias)
    Country.objects.create(name=""France"", code=""fr"", using=db_alias)
}}}
by:
{{{
    Country.objects.create(name=""USA"", code=""us"")
    Country.objects.create(name=""France"", code=""fr"")
}}}

Is this a bug or an error in the documentation?"	Bug	closed	Documentation	1.7-rc-2	Normal	fixed	migrations	Areski Belaid cmawebsite@…	Ready for checkin	1	0	0	0	0	0
