magic-removal: More conversion of old-style module imports to new-style
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1668 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
2478533c82
commit
f34d4fad4b
|
@ -505,7 +505,7 @@ startapp.args = "[appname]"
|
|||
def createsuperuser(username=None, email=None, password=None):
|
||||
"Creates a superuser account."
|
||||
from django.core import validators
|
||||
from django.models.auth import users
|
||||
from django.models.auth import User
|
||||
import getpass
|
||||
try:
|
||||
while 1:
|
||||
|
@ -515,8 +515,8 @@ def createsuperuser(username=None, email=None, password=None):
|
|||
sys.stderr.write("Error: That username is invalid.\n")
|
||||
username = None
|
||||
try:
|
||||
users.get_object(username__exact=username)
|
||||
except users.UserDoesNotExist:
|
||||
User.objects.get_object(username__exact=username)
|
||||
except User.DoesNotExist:
|
||||
break
|
||||
else:
|
||||
sys.stderr.write("Error: That username is already taken.\n")
|
||||
|
@ -547,7 +547,7 @@ def createsuperuser(username=None, email=None, password=None):
|
|||
except KeyboardInterrupt:
|
||||
sys.stderr.write("\nOperation cancelled.\n")
|
||||
sys.exit(1)
|
||||
u = users.create_user(username, email, password)
|
||||
u = User.objects.create_user(username, email, password)
|
||||
u.is_staff = True
|
||||
u.is_active = True
|
||||
u.is_superuser = True
|
||||
|
@ -689,7 +689,7 @@ def get_validation_errors(outfile):
|
|||
for fn in opts.admin.list_display:
|
||||
try:
|
||||
f = opts.get_field(fn)
|
||||
except models.FieldDoesNotExist:
|
||||
except models.FieldDoesNotExist:
|
||||
if not hasattr(cls, fn) or not callable(getattr(cls, fn)):
|
||||
e.add(opts, '"admin.list_display" refers to %r, which isn\'t a field or method.' % fn)
|
||||
else:
|
||||
|
|
|
@ -2,6 +2,7 @@ from django.core import formfields, validators
|
|||
from django.core.extensions import DjangoContext, render_to_response
|
||||
from django.core.template import Context, loader
|
||||
from django.models.auth import User
|
||||
from django.models.core import Site
|
||||
from django.views.decorators.auth import login_required
|
||||
from django.utils.httpwrappers import HttpResponseRedirect
|
||||
|
||||
|
@ -23,12 +24,11 @@ class PasswordResetForm(formfields.Manipulator):
|
|||
def save(self, domain_override=None):
|
||||
"Calculates a new password randomly and sends it to the user"
|
||||
from django.core.mail import send_mail
|
||||
from django.models.core import sites
|
||||
new_pass = User.objects.make_random_password()
|
||||
self.user_cache.set_password(new_pass)
|
||||
self.user_cache.save()
|
||||
if not domain_override:
|
||||
current_site = sites.get_current()
|
||||
current_site = Site.objects.get_current()
|
||||
site_name = current_site.name
|
||||
domain = current_site.domain
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue