Commits

Anonymous committed 63fa4a0

add support for CustomUser model

Comments (0)

Files changed (8)

djangobb_forum/admin.py

 
 from django.contrib import admin
 from django.contrib.auth import admin as auth_admin
-from django.contrib.auth.models import User
+try:
+    from django.contrib.auth import get_user_model
+    User = get_user_model()
+except ImportError:
+    from django.contrib.auth.models import User
 from django.utils.translation import ugettext_lazy as _
 
 from djangobb_forum.models import Category, Forum, Topic, Post, Profile, Reputation, \

djangobb_forum/forms.py

 
 from django import forms
 from django.conf import settings
-from django.contrib.auth.models import User
+try:
+    from django.contrib.auth import get_user_model
+    User = get_user_model()
+except ImportError:
+    from django.contrib.auth.models import User
 from django.db.models.expressions import F
 from django.utils.translation import ugettext_lazy as _
 

djangobb_forum/management/commands/djangobb_unban.py

 from datetime import datetime
 
 from django.core.management.base import BaseCommand, CommandError
-from django.contrib.auth.models import User
+try:
+    from django.contrib.auth import get_user_model
+    User = get_user_model()
+except ImportError:
+    from django.contrib.auth.models import User
 from djangobb_forum.models import Ban
 
 

djangobb_forum/models.py

 import os
 
 from django.conf import settings
-from django.contrib.auth.models import User, Group
+try:
+    from django.contrib.auth import get_user_model
+    User = get_user_model()
+except ImportError:
+    from django.contrib.auth.models import User
+from django.contrib.auth.models import Group
 from django.db import models
 from django.db.models import aggregates
 from django.db.models.signals import post_save

djangobb_forum/tests/test_forum.py

 # -*- coding: utf-8 -*-
 from django.test import TestCase, Client
-from django.contrib.auth.models import User
+try:
+    from django.contrib.auth import get_user_model
+    User = get_user_model()
+except ImportError:
+    from django.contrib.auth.models import User
 
 from djangobb_forum.models import Category, Forum, Topic, Post
 

djangobb_forum/tests/test_reputation.py

 # -*- coding: utf-8 -*-
 from django.test import TestCase
-from django.contrib.auth.models import User
+try:
+    from django.contrib.auth import get_user_model
+    User = get_user_model()
+except ImportError:
+    from django.contrib.auth.models import User
 
 from djangobb_forum.models import Post, Reputation
 

djangobb_forum/tests/test_templatetags.py

 # -*- coding: utf-8 -*-
 from django.test import TestCase
-from django.contrib.auth.models import User
+try:
+    from django.contrib.auth import get_user_model
+    User = get_user_model()
+except ImportError:
+    from django.contrib.auth.models import User
 
 from djangobb_forum.models import Post
 from djangobb_forum.templatetags.forum_extras import profile_link, link, lofi_link

djangobb_forum/views.py

 
 from django.contrib import messages
 from django.contrib.auth.decorators import login_required
-from django.contrib.auth.models import User
+try:
+    from django.contrib.auth import get_user_model
+    User = get_user_model()
+except ImportError:
+    from django.contrib.auth.models import User
 from django.contrib.sites.models import Site
 from django.core.cache import cache
 from django.core.exceptions import SuspiciousOperation
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.