jazzband / django-authority

A Django app that provides generic per-object-permissions for Django's auth app and helpers to create custom permission checks.
http://django-authority.readthedocs.org
BSD 3-Clause "New" or "Revised" License
292 stars 57 forks source link

Another option for updating the code for Django 1.5 custom user model #7

Closed supercodepoet closed 11 years ago

supercodepoet commented 11 years ago

This uses an internal utility function to grab the proper User class so that it is backwards compatible. We have a current application that uses a custom user model and would love to you django-authority. Please send me any questions, would love to get this merged.

supercodepoet commented 11 years ago

btw, all the tests passed in the authority test run

jlward commented 11 years ago

Hi, Thanks for the pull request. Two questions:

  1. I don't suppose you set up your fork to run travis? I am a little sceptical merging it in without travis at least telling me that all the tests still pass with this change.
  2. I am trying to figure out how we can test this to ensure that it actually works for with a custom user model. Any thoughts?

Let me know if you have any questions.

supercodepoet commented 11 years ago
  1. I have not setup Travis on my fork but I will do that and let you know what it shows
  2. I could add a second example django project that uses a custom user model but then the project would need django 1.5 installed to run tests.
jlward commented 11 years ago

So the version of django used for this project is not pegged to a specific version. So what you can do is make your second example app that uses a custom user model and in all the test cases raise SkipTest if the version of django != 1.5

Travis will automagically only run those tests with django 1.5

I would feel much better merging this in if there was at least one test on the custom user model.

supercodepoet commented 11 years ago

Ok, I will look into adding this in

supercodepoet commented 11 years ago

Ok, as you can see added Travis CI to my fork. I added a custom user model to the example app and activated it only when Django >= 1.5. I updated the tests to use a custom user model test fixture when Django >= 1.5. This way all the tests get run for normal auth.User and now users.User (which contains no username field)

jlward commented 11 years ago

Looks good. Thank you for adding the test.