Skip to content

Commit

Permalink
Updated to be straight import for readability
Browse files Browse the repository at this point in the history
  • Loading branch information
supercodepoet committed Jun 12, 2013
1 parent 5a2ea09 commit 770e696
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 17 deletions.
5 changes: 1 addition & 4 deletions authority/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@

from authority import permissions, get_choices_for
from authority.models import Permission
from authority.utils import get_user_class


User = get_user_class()
from authority.utils import User


class BasePermissionForm(forms.ModelForm):
Expand Down
8 changes: 3 additions & 5 deletions authority/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
from django.utils.translation import ugettext_lazy as _

from authority.managers import PermissionManager


USER_MODEL = getattr(settings, 'AUTH_USER_MODEL', 'auth.User')
from authority.utils import User


class Permission(models.Model):
Expand All @@ -23,9 +21,9 @@ class Permission(models.Model):
object_id = models.PositiveIntegerField()
content_object = generic.GenericForeignKey('content_type', 'object_id')

user = models.ForeignKey(USER_MODEL, null=True, blank=True, related_name='granted_permissions')
user = models.ForeignKey(User, null=True, blank=True, related_name='granted_permissions')
group = models.ForeignKey(Group, null=True, blank=True)
creator = models.ForeignKey(USER_MODEL, null=True, blank=True, related_name='created_permissions')
creator = models.ForeignKey(User, null=True, blank=True, related_name='created_permissions')

approved = models.BooleanField(_('approved'), default=False, help_text=_("Designates whether the permission has been approved and treated as active. Unselect this instead of deleting permissions."))

Expand Down
4 changes: 1 addition & 3 deletions authority/templatetags/permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@
from authority import permissions
from authority.models import Permission
from authority.forms import UserPermissionForm
from authority.utils import get_user_class
from authority.utils import User


register = template.Library()

User = get_user_class()


@register.simple_tag
def url_for_obj(view_name, obj):
Expand Down
5 changes: 1 addition & 4 deletions authority/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
from authority import permissions
from authority.models import Permission
from authority.exceptions import NotAModel, UnsavedModelInstance
from authority.utils import get_user_class


User = get_user_class()
from authority.utils import User


class UserPermission(permissions.BasePermission):
Expand Down
5 changes: 4 additions & 1 deletion authority/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ def get_user_class():
if hasattr(auth, "get_user_model"):
return auth.get_user_model()
else:
return auth.models.User
return auth.models.User


User = get_user_class()

1 comment on commit 770e696

@gthb
Copy link
Contributor

@gthb gthb commented on 770e696 Jul 13, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See issue #10, which is triggered by this change.

Please sign in to comment.