﻿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
23657	Migrations framework doesn't properly handle factory-generated base classes.	jfialkoff	nobody	"It is sometimes useful to construct models using factories. The code below shows one example of this. Other useful factories may or may not have fields (e.g., I have a base class factory that I use to add properties to an object with the urls for the object listing, edit page, create page and delete page).


{{{
def address_mixin_factory(address_required=True, city_required=True, state_required=True):
    # build base abstract model with the fields address, city and state and assign blank=True/False depending on the arguments.
    return AddressMixin

class FullAddress(address_mixin_factory(), models.Model):
    pass

class PartialAddress(address_mixin_factory(address_required=False), models.Model):
    pass
}}}


When you use Django migrations to migrate a model like this, the resulting migration file will have something like `bases=(AddressMixin, models.Model)`  in the call to `CreateModel` where, instead, we would want `bases=(address_mixin_factory(), models.Model)`. Also, while I have not tested this, I'm assuming the fields specified in the call to `CreateModel` will also be lacking the fields contributed by the factory-created base class."	Bug	closed	Migrations	1.7	Normal	wontfix			Unreviewed	0	0	0	0	0	0
