﻿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
26977	Instantiating an abstract model with a string ForeignKey fails with TypeError: isinstance() arg 2 must be a class, type, or tuple of classes and types	Jonas Trappenberg	Jacob Walls	"Trying to instantiate an abstract model with a foreign key worked without throwing any warnings in Django 1.8. In Django 1.9.8, this code:
{{{
class UserProfile(Model):
    user = models.ForeignKey('auth.user')
    class Meta(object):
        app_label = 'core'
        abstract = True
UserProfile()
}}}
raises this exception:
{{{
Traceback (most recent call last):
  File ""<ipython-input-7-5fa4dfdf1ad9>"", line 2, in <module>
    UserProfile()
  File "".../.venv/lib/python2.7/site-packages/django/db/models/base.py"", line 432, in __init__
    val = field.get_default()
  File "".../.venv/lib/python2.7/site-packages/django/db/models/fields/related.py"", line 905, in get_default
    if isinstance(field_default, self.remote_field.model):
TypeError: isinstance() arg 2 must be a class, type, or tuple of classes and types
}}}

While the code mentions that abstract models can not be instantiated [1], I couldn't find mention of this in the docs. Abstract models without foreign keys can still be instantiated perfectly fine.

I couldn't find any description of this change in the Release Notes, so not sure if I missed it there or if this is maybe an undocumented backwards-incompatible change.

[1] https://github.com/django/django/blob/026574e03c6b6fd20a45f97b0470afb70e41fda4/django/db/models/base.py#L284"	Cleanup/optimization	closed	Database layer (models, ORM)	1.9	Normal	fixed		Simon Charette	Ready for checkin	1	0	0	0	1	0
