Fantomas42 / django-blog-zinnia

Simple yet powerful and really extendable application for managing a blog within your Django Web site.
http://django-blog-zinnia.com/
BSD 3-Clause "New" or "Revised" License
2.11k stars 731 forks source link

Can't migrate database on fresh install with cookiecutter-django. #537

Open flaviobarros opened 6 years ago

flaviobarros commented 6 years ago

Actual behavior

I have just created a basic project with cookiecutter-django. After having a working site I tried to install zinnia following documentation but It doens't migrate the database. I receive the following error:

LookupError: Model 'users.User' not registered.

Expected behavior

The migration could be done without any error.

Steps to reproduce the issue

  1. Install cookiecutter-django basic project (Mailgun, Heroku and etc). After having a working site
  2. Install zinnia following documentation
  3. try migrate

python manage.py migrate

Specifications

Disclaimer

Before submitting an issue make sure you have:

flaviobarros commented 6 years ago

I have tested with cookiecutter-django multiple versions, using django 1.11, 1.10 and 1.9. Didn't work with any of them.

Admoroux commented 5 years ago

In zinnia/models/author.py:

def safe_get_user_model():
    """
    Safe loading of the User model, customized or not.
    """
    user_app, user_model = settings.AUTH_USER_MODEL.split('.')
    return apps.get_registered_model(user_app, user_model)

I changed it as:

[...]
from django.contrib.auth import get_user_model
[...]

def safe_get_user_model():
    """
    Safe loading of the User model, customized or not.
    """
    # user_app, user_model = settings.AUTH_USER_MODEL.split('.')
    # return apps.get_registered_model(user_app, user_model)
    return get_user_model()

and runs perfectly.

I'm trying to test it in a clean installation. If it works, i'll make a pull request with it.