Consider the following django model
from django.db import models
from django.contrib import auth
class Topic(models.Model):
user = models.ForeignKey('auth.models.User')
name = models.CharField(max_length = NameMaxLength , unique = True)
version_number = models.IntegerField(default = 0)
created_at = models.DateTimeField(auto_now_add = True)
modified_at = models.DateTimeField(auto_now = True)
update_frequency = models.IntegerField()
This model does not validate even after installing the auth_user table.
In [3]: auth.models.User.objects.all()
Out[3]: [<User: admin>]
The above statement is from django-admin shell
$ python manage.py syncdb
Error: One or more models did not validate:
topic: 'user' has a relation with model auth.models.User, which has either not
been installed or is abstract.
I am using django v1.0.4 with pinax 0.7.2 on ubuntu 11.04 , with sqlite3 database
The following Questions did not help much:
'auth.User'would have worked, too. It’s not Python’s library syntax, it’s the Django ORM’s “app.model” syntax. But you should only pass the model as a string if you’re desperately trying to solve a circular dependency. And if you have a circular dependency, your code is eff’d.