1
0
mirror of https://github.com/django/django.git synced 2025-07-19 17:19:12 +00:00

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:
Adrian Holovaty 2005-12-15 01:04:23 +00:00
parent 2478533c82
commit f34d4fad4b
2 changed files with 7 additions and 7 deletions

View File

@ -505,7 +505,7 @@ startapp.args = "[appname]"
def createsuperuser(username=None, email=None, password=None): def createsuperuser(username=None, email=None, password=None):
"Creates a superuser account." "Creates a superuser account."
from django.core import validators from django.core import validators
from django.models.auth import users from django.models.auth import User
import getpass import getpass
try: try:
while 1: while 1:
@ -515,8 +515,8 @@ def createsuperuser(username=None, email=None, password=None):
sys.stderr.write("Error: That username is invalid.\n") sys.stderr.write("Error: That username is invalid.\n")
username = None username = None
try: try:
users.get_object(username__exact=username) User.objects.get_object(username__exact=username)
except users.UserDoesNotExist: except User.DoesNotExist:
break break
else: else:
sys.stderr.write("Error: That username is already taken.\n") sys.stderr.write("Error: That username is already taken.\n")
@ -547,7 +547,7 @@ def createsuperuser(username=None, email=None, password=None):
except KeyboardInterrupt: except KeyboardInterrupt:
sys.stderr.write("\nOperation cancelled.\n") sys.stderr.write("\nOperation cancelled.\n")
sys.exit(1) sys.exit(1)
u = users.create_user(username, email, password) u = User.objects.create_user(username, email, password)
u.is_staff = True u.is_staff = True
u.is_active = True u.is_active = True
u.is_superuser = True u.is_superuser = True

View File

@ -2,6 +2,7 @@ from django.core import formfields, validators
from django.core.extensions import DjangoContext, render_to_response from django.core.extensions import DjangoContext, render_to_response
from django.core.template import Context, loader from django.core.template import Context, loader
from django.models.auth import User from django.models.auth import User
from django.models.core import Site
from django.views.decorators.auth import login_required from django.views.decorators.auth import login_required
from django.utils.httpwrappers import HttpResponseRedirect from django.utils.httpwrappers import HttpResponseRedirect
@ -23,12 +24,11 @@ class PasswordResetForm(formfields.Manipulator):
def save(self, domain_override=None): def save(self, domain_override=None):
"Calculates a new password randomly and sends it to the user" "Calculates a new password randomly and sends it to the user"
from django.core.mail import send_mail from django.core.mail import send_mail
from django.models.core import sites
new_pass = User.objects.make_random_password() new_pass = User.objects.make_random_password()
self.user_cache.set_password(new_pass) self.user_cache.set_password(new_pass)
self.user_cache.save() self.user_cache.save()
if not domain_override: if not domain_override:
current_site = sites.get_current() current_site = Site.objects.get_current()
site_name = current_site.name site_name = current_site.name
domain = current_site.domain domain = current_site.domain
else: else: