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:
Adrian Holovaty 2006-02-17 19:42:11 +00:00
parent d1a91e311a
commit f0c493f02f
10 changed files with 28 additions and 14 deletions

View File

@ -88,6 +88,7 @@ answer newbie questions, and generally made Django that much better:
Luke Plant <http://lukeplant.me.uk/>
plisk
Daniel Poelzleithner <http://poelzi.org/>
J. Rademaker
Brian Ray <http://brianray.chipy.org/>
Oliver Rutherfurd <http://rutherfurd.net/>
David Schein

View File

@ -0,0 +1 @@
VERSION = (0, 9, 1, 'SVN')

View File

@ -266,7 +266,7 @@ DATA_TYPE_MAPPING = {
'PhoneNumberField' : _('Phone number'),
'PositiveIntegerField' : _('Integer'),
'PositiveSmallIntegerField' : _('Integer'),
'SlugField' : _('String (up to 50)'),
'SlugField' : _('String (up to %(maxlength)s)'),
'SmallIntegerField' : _('Integer'),
'TextField' : _('Text'),
'TimeField' : _('Time'),

View File

@ -403,7 +403,7 @@ def _get_deleted_objects(deleted_objects, perms_needed, user, obj, opts, current
if related.opts.admin and has_related_objs:
p = '%s.%s' % (related.opts.app_label, related.opts.get_delete_permission())
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():
if related.opts in opts_seen:
continue

View File

@ -64,6 +64,14 @@ def _is_valid_dir_name(s):
# 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()
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):
"Returns a list of the CREATE TABLE SQL statements for the given app."
from django.db import backend, get_creation_module, models
@ -1119,7 +1127,7 @@ def print_error(msg, cmd):
def execute_from_command_line(action_mapping=DEFAULT_ACTION_MAPPING):
# 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',
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',

View File

@ -17,7 +17,7 @@ DATA_TYPES = {
'PhoneNumberField': 'varchar(20)',
'PositiveIntegerField': 'int CONSTRAINT [CK_int_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',
'TextField': 'text',
'TimeField': 'time',

View File

@ -21,7 +21,7 @@ DATA_TYPES = {
'PhoneNumberField': 'varchar(20)',
'PositiveIntegerField': 'integer UNSIGNED',
'PositiveSmallIntegerField': 'smallint UNSIGNED',
'SlugField': 'varchar(50)',
'SlugField': 'varchar(%(maxlength)s)',
'SmallIntegerField': 'smallint',
'TextField': 'longtext',
'TimeField': 'time',

View File

@ -21,7 +21,7 @@ DATA_TYPES = {
'PhoneNumberField': 'varchar(20)',
'PositiveIntegerField': 'integer CHECK ("%(column)s" >= 0)',
'PositiveSmallIntegerField': 'smallint CHECK ("%(column)s" >= 0)',
'SlugField': 'varchar(50)',
'SlugField': 'varchar(%(maxlength)s)',
'SmallIntegerField': 'smallint',
'TextField': 'text',
'TimeField': 'time',

View File

@ -20,7 +20,7 @@ DATA_TYPES = {
'PhoneNumberField': 'varchar(20)',
'PositiveIntegerField': 'integer unsigned',
'PositiveSmallIntegerField': 'smallint unsigned',
'SlugField': 'varchar(50)',
'SlugField': 'varchar(%(maxlength)s)',
'SmallIntegerField': 'smallint',
'TextField': 'text',
'TimeField': 'time',

View File

@ -410,7 +410,11 @@ Here are all available field types:
containing only letters, numbers, underscores or hyphens. They're generally
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
from which to auto-populate the slug, via JavaScript, in the object's admin