2013-08-06 7 views
5

Recentemente ho installato Blogango, dove ho avuto il seguente errore:campo modulo non può creare per 'created_by' ancora, perché il suo modello 'users.User' collegate non è stato caricato ancora

CommandError: One or more models did not validate: 
blogango.blogentry: 'created_by' defines a relation with the model 'auth.User', which has been swapped out. Update the relation to point at settings.AUTH_USER_MODEL. 

Così ho aggiunto impostazioni .AUTH_USER_MODEL e ora ricevo il seguente messaggio:

ValueError: Cannot create form field for 'created_by' yet, because its related model 'users.User' has not been loaded yet 

ho passato la mia settings.py cui chiede AUTH_USER_MODEL = 'users.User', e si è trasferito più in alto sulla settings.py per cercare di farlo caricare prima.

Come richiesto: created_by = models.ForeignKey(settings.AUTH_USER_MODEL, unique=False)

Cosa posso fare per risolvere questo problema?

+2

Possiamo vedere il modello per 'created_by'? –

+0

La domanda ora mostra 'created_by'. –

+0

Cosa succede se metti 'settings.AUTH_USER_MODEL' tra virgolette? cioè, 'created_by = models.ForeignKey ('settings.AUTH_USER_MODEL', unique = False) –

risposta

2

Sembra che Blogango (è https://github.com/agiliq/django-blogango?) Non supporta lo custom user models introdotto in Django 1.5.

La patch in Blogango dovrebbe essere abbastanza semplice, basta sostituire:

from django.contrib.auth.models import User 

con:

from django.contrib.auth import get_user_model 
User = get_user_model() 

in django-blogango/blogango/models.py.

Problemi correlati