Added support for custom AUTH_USER_MODEL #235

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@rca
rca commented May 9, 2014

Running migrations in a project that defines a custom user model results
in the error:

ValueError: Lookup failed for model referenced by field admin.LogEntry.user: accounts.User

More about the issue can be found at
https://code.djangoproject.com/ticket/22563.

Adding the swappable_dependency() dependency solves the issue allowing
the migration to run successfully.

@rca rca Added support for custom AUTH_USER_MODEL
Running migrations in a project that defines a custom user model results
in the error:

```
ValueError: Lookup failed for model referenced by field admin.LogEntry.user: accounts.User
```

More about the issue can be found at
https://code.djangoproject.com/ticket/22563.

Adding the `swappable_dependency()` dependency solves the issue allowing
the migration to run successfully.
e9a4e4a
@apollo13
apollo13 commented May 9, 2014

That makes no sense. Taggit has no depdency on auth/users

@rca
rca commented May 9, 2014

@apollo13 This is true, I was stumped for a bit because taggit does not require the user model. However please try the following; I'm curious to know if this works for you:

  • create a pristine django project (may as well use the 1.7.x branch to test: git+https://github.com/django/django@stable/1.7.x)
  • create an app that defines a custom user model, wire it in, run manage.py makemigrations for the custom user model
  • add taggit to the installed apps
  • run manage.py migrate

In my case, I already had a working database with the custom user model and simply adding taggit and attempting to run its migrations failed. Comments 22 and 24 in the Django issue tracker cover my experience.

Thanks!

@apollo13
apollo13 commented May 9, 2014

I'll test it at the djangocon sprints, but that sounds like a django bug
On May 9, 2014 6:58 PM, "Roberto Aguilar" notifications@github.com wrote:

@apollo13 https://github.com/apollo13 This is true, I was stumped for a
bit because taggit does not require the user model. However please try the
following; I'm curious to know if this works for you:

  • create a pristine django project (may as well use the 1.7.x branch
    to test: git+https://github.com/django/django@stable/1.7.x)
  • create an app that defines a custom user model, wire it in, run manage.py
    makemigrations for the custom user model
  • add taggit to the installed apps
  • run manage.py migrate

In my case, I already had a working database with the custom user model
and simply adding taggit and attempting to run its migrations failed.
Comments 22 and 24 in the Django issue tracker cover my experience.

Thanks!


Reply to this email directly or view it on GitHubhttps://github.com/alex/django-taggit/pull/235#issuecomment-42688745
.

@rca
rca commented May 9, 2014

@apollo13 I agree it sounds like a Django bug. I'll wait for your feedback on whether this patch makes sense before fixing the broken test.

Thanks!

@apollo13
apollo13 commented Aug 9, 2014

Definitelly a Django issue. @rca I think this is fixed in Django by now, can you confirm? (try with the taggit develop branch)

@apollo13 apollo13 closed this Aug 9, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment