Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Support Django 1.5 custom user models #797

wants to merge 1 commit into


None yet
7 participants

marblar commented Feb 5, 2013

See #790

Support Django 1.5 custom user models
Thanks to ondrowan, reinspijkerman, bmease, and lukashed for contributions.

ondrowan commented Feb 5, 2013

I'm in favor of this change over my pull request (closed it).

+1 This patch works for me on 1.5


ntucker commented Feb 15, 2013

You shouldn't be calling get_user_model() in the module level of models.py. This is likely to cause circular import errors. (This is the reason they recommend using the string method for foreignkeys in the Django documentation.)

If you don't use the User model, why import it?


marblar replied Feb 15, 2013

This makes the version-appropriate user model available as tastypie.models.User, so in other tastypie submodules we can replace

from django.contrib.auth.models import User


from tastypie.models import User

And leave a lot of code unchanged.


toastdriven commented Feb 15, 2013

I vastly prefer ntucker's approach in #804. Tastypie shouldn't be making ANY assumptions about auth.models.User or any other DB-backed models being always available. There are lots of people who don't use auth (or a plain RDBMS) with Tastypie & we shouldn't be hurting them as a result.

Some amalgamation of the tests from this PR & the code from #804 would be best.


marblar commented Feb 16, 2013

I agree.

I had placed the import in the models.py mostly for convenience, and hadn't considered the side effects of importing it there.

I'll submit a PR to @ntucker's branch with the tests.

@marblar marblar closed this Feb 16, 2013

@marblar marblar reopened this Feb 16, 2013


marblar commented Feb 16, 2013

I'm not seeing @ntucker's repo as an option for a base repo, but 6988661 applies cleanly to his branch.

How can i copy this commit


marblar replied Feb 26, 2013

@gmpchheang I'm sorry, let me make sure I understand your question: Do you have another branch and you want to apply this changeset on top of it?


marblar replied Feb 26, 2013

If that's what you're trying to do, type:

git remote add marblar git@github.com:marblar/django-tastypie.git

To add my repo as a remote. Then type:

git fetch marblar

To get the refs into your local repository. Finally,

git cherry-pick 6109210

To apply this commit on top of your current branch. Then type

git remote rm marblar

So that my branches don't clutter up your repo.

But you probably want to do all this with ntucker@2d794d3

Oh thz, i just want to copy your branch AUTH_US.


marblar replied Feb 26, 2013

In that case:

git clone git@github.com:marblar/django-tastypie.git
cd django-tastypie

And you should be all set.

@marblar marblar closed this Feb 26, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment