Permalink
Browse files

Fix isinstance check

  • Loading branch information...
1 parent aa07f5a commit f1cdf1fa1af74e86ff1ee5ac2a8f9f68ea0a8964 @paltman paltman committed Aug 20, 2012
Showing with 3 additions and 6 deletions.
  1. +1 −3 phileo/auth_backends.py
  2. +2 −3 phileo/utils.py
View
@@ -8,9 +8,7 @@ class CanLikeBackend(ModelBackend):
supports_anonymous_user = True
def is_allowed(self, obj):
- return _allowed(
- "%s.%s" % (obj.__class__.__module__, obj.__class__.__name__)
- )
+ return _allowed(obj)
def has_perm(self, user, perm, obj=None):
if perm == "phileo.can_like":
View
@@ -1,5 +1,5 @@
from django.core.urlresolvers import reverse
-from django.db.models.base import ModelBase
+from django.db import models
from django.contrib.contenttypes.models import ContentType
@@ -12,13 +12,12 @@ def name(obj):
def _allowed(model):
- if isinstance(model, ModelBase):
+ if isinstance(model, models.Model):
app_model = name(model)
elif isinstance(model, str):
app_model = model
else:
app_model = str(model)
-
return app_model in LIKABLE_MODELS

0 comments on commit f1cdf1f

Please sign in to comment.