django 1.4 orm standalone - GenericForeignKey

48 views
Skip to first unread message

Vaal

unread,
Jan 27, 2012, 1:21:06 PM1/27/12
to Django users
Hi!
In version 1.3 I have no problem using GenericForeignKey in standalone
scripts with Django ORm and GenericForeignKey.
And in 1.4 there is a problem.

http://dpaste.com/694017/

(virtualenv) C:\Users\user\Desktop\django-test>python django14.py
Traceback (most recent call last):
File "django14.py", line 62, in <module>
main()
File "django14.py", line 54, in main
test1.parent = test2
File "D:\Development\virtualenv\lib\site-packages\django\contrib
\contenttypes\generic.py", line 13
9, in __set__
ct = self.get_content_type(obj=value)
File "D:\Development\virtualenv\lib\site-packages\django\contrib
\contenttypes\generic.py", line 58
, in get_content_type
return
ContentType.objects.db_manager(obj._state.db).get_for_model(obj)
AttributeError: 'NoneType' object has no attribute 'objects'

In version 1.4 this is possible? or no longer there?

Vaal

unread,
Jan 27, 2012, 5:02:45 PM1/27/12
to Django users
think I found a solution, but need to check[code]settings.configure( 
  DATABASES={        'default': {            'ENGINE':
'django.db.backends.sqlite3',            'NAME': 'db.sqlite',     
  }    },    INSTALLED_APPS=(    'django.contrib.contenttypes',))[/
code]
Reply all
Reply to author
Forward
0 new messages