﻿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
25122	GenericRelation with a string argument will raise an AttributeError when accessed.	martin-c	nobody	"In other relationship fields it is possible to specify the target model by passing its model name as a string, such as 
{{{
#!python
class Car(models.Model):
    manufacturer = models.ForeignKey('production.Manufacturer')
}}}
However, in the case of a GenericRelation,
{{{
#!python
class Car(models.Model):
    manufacturers = GenericRelation('production.Manufacturer')
}}}
accessing the manufacturers field will cause a AttributeError to be raised.
{{{
Traceback (most recent call last):
  File ""<console>"", line 1, in <module>
  File ""/Users/.../.python-env/lib/python2.7/site-packages/django/contrib/contenttypes/fields.py"", line 406, in __get__
    superclass = rel_model._default_manager.__class__
AttributeError: 'unicode' object has no attribute '_default_manager'
}}}
So it seems only the target class instance can be passed to GenericRelation().

"	Bug	closed	contrib.contenttypes	1.8	Normal	worksforme	GenericRelation, AttributeError		Unreviewed	0	0	0	0	0	0
