magic-removal: Merged to [2328]
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2329 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
d1a91e311a
commit
f0c493f02f
1
AUTHORS
1
AUTHORS
|
@ -88,6 +88,7 @@ answer newbie questions, and generally made Django that much better:
|
||||||
Luke Plant <http://lukeplant.me.uk/>
|
Luke Plant <http://lukeplant.me.uk/>
|
||||||
plisk
|
plisk
|
||||||
Daniel Poelzleithner <http://poelzi.org/>
|
Daniel Poelzleithner <http://poelzi.org/>
|
||||||
|
J. Rademaker
|
||||||
Brian Ray <http://brianray.chipy.org/>
|
Brian Ray <http://brianray.chipy.org/>
|
||||||
Oliver Rutherfurd <http://rutherfurd.net/>
|
Oliver Rutherfurd <http://rutherfurd.net/>
|
||||||
David Schein
|
David Schein
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
VERSION = (0, 9, 1, 'SVN')
|
|
@ -266,7 +266,7 @@ DATA_TYPE_MAPPING = {
|
||||||
'PhoneNumberField' : _('Phone number'),
|
'PhoneNumberField' : _('Phone number'),
|
||||||
'PositiveIntegerField' : _('Integer'),
|
'PositiveIntegerField' : _('Integer'),
|
||||||
'PositiveSmallIntegerField' : _('Integer'),
|
'PositiveSmallIntegerField' : _('Integer'),
|
||||||
'SlugField' : _('String (up to 50)'),
|
'SlugField' : _('String (up to %(maxlength)s)'),
|
||||||
'SmallIntegerField' : _('Integer'),
|
'SmallIntegerField' : _('Integer'),
|
||||||
'TextField' : _('Text'),
|
'TextField' : _('Text'),
|
||||||
'TimeField' : _('Time'),
|
'TimeField' : _('Time'),
|
||||||
|
|
|
@ -403,7 +403,7 @@ def _get_deleted_objects(deleted_objects, perms_needed, user, obj, opts, current
|
||||||
if related.opts.admin and has_related_objs:
|
if related.opts.admin and has_related_objs:
|
||||||
p = '%s.%s' % (related.opts.app_label, related.opts.get_delete_permission())
|
p = '%s.%s' % (related.opts.app_label, related.opts.get_delete_permission())
|
||||||
if not user.has_perm(p):
|
if not user.has_perm(p):
|
||||||
perms_needed.add(rel_opts.verbose_name)
|
perms_needed.add(rel_opts_name)
|
||||||
for related in opts.get_all_related_many_to_many_objects():
|
for related in opts.get_all_related_many_to_many_objects():
|
||||||
if related.opts in opts_seen:
|
if related.opts in opts_seen:
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -64,6 +64,14 @@ def _is_valid_dir_name(s):
|
||||||
# field as the field to which it points.
|
# field as the field to which it points.
|
||||||
get_rel_data_type = lambda f: (f.get_internal_type() in ('AutoField', 'PositiveIntegerField', 'PositiveSmallIntegerField')) and 'IntegerField' or f.get_internal_type()
|
get_rel_data_type = lambda f: (f.get_internal_type() in ('AutoField', 'PositiveIntegerField', 'PositiveSmallIntegerField')) and 'IntegerField' or f.get_internal_type()
|
||||||
|
|
||||||
|
def get_version():
|
||||||
|
"Returns the version as a human-format string."
|
||||||
|
from django import VERSION
|
||||||
|
v = '.'.join([str(i) for i in VERSION[:-1]])
|
||||||
|
if VERSION[3]:
|
||||||
|
v += ' (%s)' % VERSION[3]
|
||||||
|
return v
|
||||||
|
|
||||||
def get_sql_create(app):
|
def get_sql_create(app):
|
||||||
"Returns a list of the CREATE TABLE SQL statements for the given app."
|
"Returns a list of the CREATE TABLE SQL statements for the given app."
|
||||||
from django.db import backend, get_creation_module, models
|
from django.db import backend, get_creation_module, models
|
||||||
|
@ -821,8 +829,8 @@ class ModelErrorCollection:
|
||||||
|
|
||||||
def get_validation_errors(outfile, app=None):
|
def get_validation_errors(outfile, app=None):
|
||||||
"""
|
"""
|
||||||
Validates all models that are part of the specified app. If no app name is provided,
|
Validates all models that are part of the specified app. If no app name is provided,
|
||||||
validates all models of all installed apps. Writes errors, if any, to outfile.
|
validates all models of all installed apps. Writes errors, if any, to outfile.
|
||||||
Returns number of errors.
|
Returns number of errors.
|
||||||
"""
|
"""
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
@ -870,7 +878,7 @@ def get_validation_errors(outfile, app=None):
|
||||||
rel_opts = f.rel.to._meta
|
rel_opts = f.rel.to._meta
|
||||||
if f.rel.to not in models.get_models():
|
if f.rel.to not in models.get_models():
|
||||||
e.add(opts, "'%s' relates to uninstalled model %s" % (f.name, rel_opts.object_name))
|
e.add(opts, "'%s' relates to uninstalled model %s" % (f.name, rel_opts.object_name))
|
||||||
|
|
||||||
rel_name = RelatedObject(f.rel.to, cls, f).get_accessor_name()
|
rel_name = RelatedObject(f.rel.to, cls, f).get_accessor_name()
|
||||||
for r in rel_opts.fields:
|
for r in rel_opts.fields:
|
||||||
if r.name == rel_name:
|
if r.name == rel_name:
|
||||||
|
@ -879,12 +887,12 @@ def get_validation_errors(outfile, app=None):
|
||||||
if r.name == rel_name:
|
if r.name == rel_name:
|
||||||
e.add(opts, "'%s' accessor name '%s.%s' clashes with a m2m field" % (f.name, rel_opts.object_name, r.name))
|
e.add(opts, "'%s' accessor name '%s.%s' clashes with a m2m field" % (f.name, rel_opts.object_name, r.name))
|
||||||
for r in rel_opts.get_all_related_many_to_many_objects():
|
for r in rel_opts.get_all_related_many_to_many_objects():
|
||||||
if r.get_accessor_name() == rel_name:
|
if r.get_accessor_name() == rel_name:
|
||||||
e.add(opts, "'%s' accessor name '%s.%s' clashes with a related m2m field" % (f.name, rel_opts.object_name, r.get_accessor_name()))
|
e.add(opts, "'%s' accessor name '%s.%s' clashes with a related m2m field" % (f.name, rel_opts.object_name, r.get_accessor_name()))
|
||||||
for r in rel_opts.get_all_related_objects():
|
for r in rel_opts.get_all_related_objects():
|
||||||
if r.get_accessor_name() == rel_name and r.field is not f:
|
if r.get_accessor_name() == rel_name and r.field is not f:
|
||||||
e.add(opts, "'%s' accessor name '%s.%s' clashes with a related field" % (f.name, rel_opts.object_name, r.get_accessor_name()))
|
e.add(opts, "'%s' accessor name '%s.%s' clashes with a related field" % (f.name, rel_opts.object_name, r.get_accessor_name()))
|
||||||
|
|
||||||
for i, f in enumerate(opts.many_to_many):
|
for i, f in enumerate(opts.many_to_many):
|
||||||
# Check to see if the related m2m field will clash with any
|
# Check to see if the related m2m field will clash with any
|
||||||
# existing fields, m2m fields, m2m related objects or related objects
|
# existing fields, m2m fields, m2m related objects or related objects
|
||||||
|
@ -900,7 +908,7 @@ def get_validation_errors(outfile, app=None):
|
||||||
if r.name == rel_name:
|
if r.name == rel_name:
|
||||||
e.add(opts, "'%s' m2m accessor name '%s.%s' clashes with a m2m field" % (f.name, rel_opts.object_name, r.name))
|
e.add(opts, "'%s' m2m accessor name '%s.%s' clashes with a m2m field" % (f.name, rel_opts.object_name, r.name))
|
||||||
for r in rel_opts.get_all_related_many_to_many_objects():
|
for r in rel_opts.get_all_related_many_to_many_objects():
|
||||||
if r.get_accessor_name() == rel_name and r.field is not f:
|
if r.get_accessor_name() == rel_name and r.field is not f:
|
||||||
e.add(opts, "'%s' m2m accessor name '%s.%s' clashes with a related m2m field" % (f.name, rel_opts.object_name, r.get_accessor_name()))
|
e.add(opts, "'%s' m2m accessor name '%s.%s' clashes with a related m2m field" % (f.name, rel_opts.object_name, r.get_accessor_name()))
|
||||||
for r in rel_opts.get_all_related_objects():
|
for r in rel_opts.get_all_related_objects():
|
||||||
if r.get_accessor_name() == rel_name:
|
if r.get_accessor_name() == rel_name:
|
||||||
|
@ -1119,7 +1127,7 @@ def print_error(msg, cmd):
|
||||||
|
|
||||||
def execute_from_command_line(action_mapping=DEFAULT_ACTION_MAPPING):
|
def execute_from_command_line(action_mapping=DEFAULT_ACTION_MAPPING):
|
||||||
# Parse the command-line arguments. optparse handles the dirty work.
|
# Parse the command-line arguments. optparse handles the dirty work.
|
||||||
parser = DjangoOptionParser(get_usage(action_mapping))
|
parser = DjangoOptionParser(usage=get_usage(action_mapping), version=get_version())
|
||||||
parser.add_option('--settings',
|
parser.add_option('--settings',
|
||||||
help='Python path to settings module, e.g. "myproject.settings.main". If this isn\'t provided, the DJANGO_SETTINGS_MODULE environment variable will be used.')
|
help='Python path to settings module, e.g. "myproject.settings.main". If this isn\'t provided, the DJANGO_SETTINGS_MODULE environment variable will be used.')
|
||||||
parser.add_option('--pythonpath',
|
parser.add_option('--pythonpath',
|
||||||
|
|
|
@ -17,7 +17,7 @@ DATA_TYPES = {
|
||||||
'PhoneNumberField': 'varchar(20)',
|
'PhoneNumberField': 'varchar(20)',
|
||||||
'PositiveIntegerField': 'int CONSTRAINT [CK_int_pos_%(column)s] CHECK ([%(column)s] > 0)',
|
'PositiveIntegerField': 'int CONSTRAINT [CK_int_pos_%(column)s] CHECK ([%(column)s] > 0)',
|
||||||
'PositiveSmallIntegerField': 'smallint CONSTRAINT [CK_smallint_pos_%(column)s] CHECK ([%(column)s] > 0)',
|
'PositiveSmallIntegerField': 'smallint CONSTRAINT [CK_smallint_pos_%(column)s] CHECK ([%(column)s] > 0)',
|
||||||
'SlugField': 'varchar(50)',
|
'SlugField': 'varchar(%(maxlength)s)',
|
||||||
'SmallIntegerField': 'smallint',
|
'SmallIntegerField': 'smallint',
|
||||||
'TextField': 'text',
|
'TextField': 'text',
|
||||||
'TimeField': 'time',
|
'TimeField': 'time',
|
||||||
|
|
|
@ -21,7 +21,7 @@ DATA_TYPES = {
|
||||||
'PhoneNumberField': 'varchar(20)',
|
'PhoneNumberField': 'varchar(20)',
|
||||||
'PositiveIntegerField': 'integer UNSIGNED',
|
'PositiveIntegerField': 'integer UNSIGNED',
|
||||||
'PositiveSmallIntegerField': 'smallint UNSIGNED',
|
'PositiveSmallIntegerField': 'smallint UNSIGNED',
|
||||||
'SlugField': 'varchar(50)',
|
'SlugField': 'varchar(%(maxlength)s)',
|
||||||
'SmallIntegerField': 'smallint',
|
'SmallIntegerField': 'smallint',
|
||||||
'TextField': 'longtext',
|
'TextField': 'longtext',
|
||||||
'TimeField': 'time',
|
'TimeField': 'time',
|
||||||
|
|
|
@ -21,7 +21,7 @@ DATA_TYPES = {
|
||||||
'PhoneNumberField': 'varchar(20)',
|
'PhoneNumberField': 'varchar(20)',
|
||||||
'PositiveIntegerField': 'integer CHECK ("%(column)s" >= 0)',
|
'PositiveIntegerField': 'integer CHECK ("%(column)s" >= 0)',
|
||||||
'PositiveSmallIntegerField': 'smallint CHECK ("%(column)s" >= 0)',
|
'PositiveSmallIntegerField': 'smallint CHECK ("%(column)s" >= 0)',
|
||||||
'SlugField': 'varchar(50)',
|
'SlugField': 'varchar(%(maxlength)s)',
|
||||||
'SmallIntegerField': 'smallint',
|
'SmallIntegerField': 'smallint',
|
||||||
'TextField': 'text',
|
'TextField': 'text',
|
||||||
'TimeField': 'time',
|
'TimeField': 'time',
|
||||||
|
|
|
@ -20,7 +20,7 @@ DATA_TYPES = {
|
||||||
'PhoneNumberField': 'varchar(20)',
|
'PhoneNumberField': 'varchar(20)',
|
||||||
'PositiveIntegerField': 'integer unsigned',
|
'PositiveIntegerField': 'integer unsigned',
|
||||||
'PositiveSmallIntegerField': 'smallint unsigned',
|
'PositiveSmallIntegerField': 'smallint unsigned',
|
||||||
'SlugField': 'varchar(50)',
|
'SlugField': 'varchar(%(maxlength)s)',
|
||||||
'SmallIntegerField': 'smallint',
|
'SmallIntegerField': 'smallint',
|
||||||
'TextField': 'text',
|
'TextField': 'text',
|
||||||
'TimeField': 'time',
|
'TimeField': 'time',
|
||||||
|
|
|
@ -410,7 +410,11 @@ Here are all available field types:
|
||||||
containing only letters, numbers, underscores or hyphens. They're generally
|
containing only letters, numbers, underscores or hyphens. They're generally
|
||||||
used in URLs.
|
used in URLs.
|
||||||
|
|
||||||
Implies ``maxlength=50`` and ``db_index=True``.
|
In the Django development version, you can specify ``maxlength``. If
|
||||||
|
``maxlength`` is not specified, Django will use a default length of 50. In
|
||||||
|
previous Django versions, there's no way to override the length of 50.
|
||||||
|
|
||||||
|
Implies ``db_index=True``.
|
||||||
|
|
||||||
Accepts an extra option, ``prepopulate_from``, which is a list of fields
|
Accepts an extra option, ``prepopulate_from``, which is a list of fields
|
||||||
from which to auto-populate the slug, via JavaScript, in the object's admin
|
from which to auto-populate the slug, via JavaScript, in the object's admin
|
||||||
|
|
Loading…
Reference in New Issue