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.forms import extras
from django.core.files.storage import default_storage from django.core.files.storage import default_storage
from django.conf import settings from django.conf import settings
from django.contrib.auth.models import User
from django.utils.translation import ugettext as _ 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: try:
from django.utils import timezone from django.utils import timezone
except ImportError: except ImportError:

View File

@ -10,7 +10,11 @@ users who don't yet have them.
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
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 helpdesk.models import UserSettings from helpdesk.models import UserSettings
from helpdesk.settings import DEFAULT_USER_SETTINGS from helpdesk.settings import DEFAULT_USER_SETTINGS

View File

@ -13,7 +13,11 @@ through templates/helpdesk/help_api.html.
from django import forms from django import forms
from django.contrib.auth import authenticate from django.contrib.auth import authenticate
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.http import HttpResponse from django.http import HttpResponse
from django.shortcuts import render_to_response from django.shortcuts import render_to_response
from django.template import loader, Context from django.template import loader, Context

View File

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

View File

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