mirror of
https://github.com/django/django.git
synced 2025-06-29 15:29:13 +00:00
magic-removal: django-admin.py init now installs django.contrib.auth
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1848 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
4d6ab8b308
commit
fbb47dbd9d
@ -457,9 +457,9 @@ def init_minimal():
|
|||||||
"Initializes the database."
|
"Initializes the database."
|
||||||
try:
|
try:
|
||||||
from django.db import backend, connection, models
|
from django.db import backend, connection, models
|
||||||
from django.models import auth, core
|
from django.models import core
|
||||||
cursor = connection.cursor()
|
cursor = connection.cursor()
|
||||||
for sql in get_sql_create(core) + get_sql_create(auth) + get_sql_initial_data(core) + get_sql_initial_data(auth):
|
for sql in get_sql_create(core) + get_sql_initial_data(core):
|
||||||
cursor.execute(sql)
|
cursor.execute(sql)
|
||||||
|
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
@ -476,14 +476,17 @@ def init_minimal():
|
|||||||
init_minimal.args = ''
|
init_minimal.args = ''
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
"Initializes the database with sessions, sites, auth and core."
|
"Initializes the database with auth, sessions, sites and core."
|
||||||
try:
|
try:
|
||||||
from django.db import backend, connection, models
|
from django.db import backend, connection, models
|
||||||
from django.models import auth, core
|
from django.models import core
|
||||||
from django.contrib.sites.models import Site
|
from django.contrib.sites.models import Site
|
||||||
cursor = connection.cursor()
|
cursor = connection.cursor()
|
||||||
for sql in get_sql_create(core) + get_sql_create(auth) + get_sql_initial_data(core) + get_sql_initial_data(auth):
|
for sql in get_sql_create(core) + get_sql_initial_data(core):
|
||||||
cursor.execute(sql)
|
cursor.execute(sql)
|
||||||
|
# Install django.contrib.auth.
|
||||||
|
auth_app = models.get_app('auth')
|
||||||
|
install(auth_app)
|
||||||
# Install django.contrib.sessions.
|
# Install django.contrib.sessions.
|
||||||
sessions_app = models.get_app('sessions')
|
sessions_app = models.get_app('sessions')
|
||||||
install(sessions_app)
|
install(sessions_app)
|
||||||
@ -544,7 +547,7 @@ install.args = APP_ARGS
|
|||||||
|
|
||||||
def installperms(app):
|
def installperms(app):
|
||||||
"Installs any permissions for the given app, if needed."
|
"Installs any permissions for the given app, if needed."
|
||||||
from django.models.auth import Permission
|
from django.contrib.auth.models import Permission
|
||||||
from django.models.core import Package
|
from django.models.core import Package
|
||||||
from django.db.models import get_models
|
from django.db.models import get_models
|
||||||
num_added = 0
|
num_added = 0
|
||||||
@ -625,7 +628,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 User
|
from django.contrib.auth.models import User
|
||||||
import getpass
|
import getpass
|
||||||
try:
|
try:
|
||||||
while 1:
|
while 1:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user