Skip to content
Create a gist now

Instantly share code, notes, and snippets.

@loic /foo.diff

diff --git a/django/contrib/auth/ b/django/contrib/auth/
index 5b89fe8..e8c796a 100644
--- a/django/contrib/auth/
+++ b/django/contrib/auth/
@@ -13,7 +13,6 @@ from django.contrib import auth
from django.contrib.auth.hashers import (
check_password, make_password, is_password_usable)
from django.contrib.auth.signals import user_logged_in
-from django.contrib.contenttypes.models import ContentType
from django.utils.encoding import python_2_unicode_compatible
@@ -29,6 +28,10 @@ user_logged_in.connect(update_last_login)
class PermissionManager(models.Manager):
def get_by_natural_key(self, codename, app_label, model):
+ # Import here since the contenttypes app may not be ready
+ # when this file is imported.
+ from django.contrib.contenttypes.models import ContentType
return self.get(
@@ -61,7 +64,7 @@ class Permission(models.Model):
created for each Django model.
name = models.CharField(_('name'), max_length=50)
- content_type = models.ForeignKey(ContentType)
+ content_type = models.ForeignKey('contenttypes.ContentType')
codename = models.CharField(_('codename'), max_length=100)
objects = PermissionManager()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.