Changed references from auth.User to get_user_model (views, forms & commands)

This commit is contained in:
Gabriel Pichot 2014-06-18 16:21:37 +02:00
parent 333429f21f
commit 27217edf4a
5 changed files with 25 additions and 5 deletions

View File

@ -13,8 +13,12 @@ from django import forms
from django.forms import extras
from django.core.files.storage import default_storage
from django.conf import settings
from django.contrib.auth.models import User
from django.utils.translation import ugettext as _
try:
from django.contrib.auth import get_user_model
User = get_user_model()
except ImportError:
from django.contrib.auth.models import User
try:
from django.utils import timezone
except ImportError:

View File

@ -10,6 +10,10 @@ users who don't yet have them.
from django.utils.translation import ugettext as _
from django.core.management.base import BaseCommand
try:
from django.contrib.auth import get_user_model
User = get_user_model()
except ImportError:
from django.contrib.auth.models import User
from helpdesk.models import UserSettings

View File

@ -13,6 +13,10 @@ through templates/helpdesk/help_api.html.
from django import forms
from django.contrib.auth import authenticate
try:
from django.contrib.auth import get_user_model
User = get_user_model()
except ImportError:
from django.contrib.auth.models import User
from django.http import HttpResponse
from django.shortcuts import render_to_response

View File

@ -7,6 +7,10 @@ views/feeds.py - A handful of staff-only RSS feeds to provide ticket details
to feed readers or similar software.
"""
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.syndication.views import Feed
from django.core.urlresolvers import reverse

View File

@ -11,6 +11,10 @@ from datetime import datetime, timedelta
import sys
from django.conf import settings
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.decorators import login_required, user_passes_test
from django.core.files.base import ContentFile