cfpb / django-flags

Feature flags for Django projects
https://cfpb.github.io/django-flags/
Creative Commons Zero v1.0 Universal
260 stars 32 forks source link

Allow user_condition to work with custom user models #7

Closed callorico closed 6 years ago

callorico commented 6 years ago

Previously, user_condition was assuming that the default User model was being used. This causes an error in projects using custom user models.

Instead of taking the hit of loading the user record from the database again within the condition, we should be able to just compare the provided username against the user instance that is already attached to the request.

Both the AbstractBaseUser and AnonymousUser implement a get_username() function so it should be safe to rely on that.

coveralls commented 6 years ago

Pull Request Test Coverage Report for Build 72


Totals Coverage Status
Change from base Build 65: 0.0%
Covered Lines: 767
Relevant Lines: 767

💛 - Coveralls