Django

Code

Changeset 2329

Show
Ignore:
Timestamp:
02/17/06 13:42:11 (3 years ago)
Author:
adrian
Message:

magic-removal: Merged to [2328]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/magic-removal/AUTHORS

    r2301 r2329  
    8989    plisk 
    9090    Daniel Poelzleithner <http://poelzi.org/> 
     91    J. Rademaker 
    9192    Brian Ray <http://brianray.chipy.org/> 
    9293    Oliver Rutherfurd <http://rutherfurd.net/> 
  • django/branches/magic-removal/django/contrib/admin/views/doc.py

    r2278 r2329  
    267267    'PositiveIntegerField'      : _('Integer'), 
    268268    'PositiveSmallIntegerField' : _('Integer'), 
    269     'SlugField'                 : _('String (up to 50)'), 
     269    'SlugField'                 : _('String (up to %(maxlength)s)'), 
    270270    'SmallIntegerField'         : _('Integer'), 
    271271    'TextField'                 : _('Text'), 
  • django/branches/magic-removal/django/contrib/admin/views/main.py

    r2220 r2329  
    404404                p = '%s.%s' % (related.opts.app_label, related.opts.get_delete_permission()) 
    405405                if not user.has_perm(p): 
    406                     perms_needed.add(rel_opts.verbose_name) 
     406                    perms_needed.add(rel_opts_name) 
    407407    for related in opts.get_all_related_many_to_many_objects(): 
    408408        if related.opts in opts_seen: 
  • django/branches/magic-removal/django/core/management.py

    r2313 r2329  
    6464# field as the field to which it points. 
    6565get_rel_data_type = lambda f: (f.get_internal_type() in ('AutoField', 'PositiveIntegerField', 'PositiveSmallIntegerField')) and 'IntegerField' or f.get_internal_type() 
     66 
     67def get_version(): 
     68    "Returns the version as a human-format string." 
     69    from django import VERSION 
     70    v = '.'.join([str(i) for i in VERSION[:-1]]) 
     71    if VERSION[3]: 
     72        v += ' (%s)' % VERSION[3] 
     73    return v 
    6674 
    6775def get_sql_create(app): 
     
    822830def get_validation_errors(outfile, app=None): 
    823831    """ 
    824     Validates all models that are part of the specified app. If no app name is provided,  
    825     validates all models of all installed apps. Writes errors, if any, to outfile.  
     832    Validates all models that are part of the specified app. If no app name is provided, 
     833    validates all models of all installed apps. Writes errors, if any, to outfile. 
    826834    Returns number of errors. 
    827835    """ 
     
    871879                if f.rel.to not in models.get_models(): 
    872880                     e.add(opts, "'%s' relates to uninstalled model %s" % (f.name, rel_opts.object_name)) 
    873                                      
     881 
    874882                rel_name = RelatedObject(f.rel.to, cls, f).get_accessor_name() 
    875883                for r in rel_opts.fields: 
     
    880888                        e.add(opts, "'%s' accessor name '%s.%s' clashes with a m2m field" % (f.name, rel_opts.object_name, r.name)) 
    881889                for r in rel_opts.get_all_related_many_to_many_objects(): 
    882                     if r.get_accessor_name() == rel_name:                             
     890                    if r.get_accessor_name() == rel_name: 
    883891                        e.add(opts, "'%s' accessor name '%s.%s' clashes with a related m2m field" % (f.name, rel_opts.object_name, r.get_accessor_name())) 
    884892                for r in rel_opts.get_all_related_objects(): 
    885893                    if r.get_accessor_name() == rel_name and r.field is not f: 
    886894                        e.add(opts, "'%s' accessor name '%s.%s' clashes with a related field" % (f.name, rel_opts.object_name, r.get_accessor_name())) 
    887                  
     895 
    888896        for i, f in enumerate(opts.many_to_many): 
    889897            # Check to see if the related m2m field will clash with any 
     
    901909                    e.add(opts, "'%s' m2m accessor name '%s.%s' clashes with a m2m field" % (f.name, rel_opts.object_name, r.name)) 
    902910            for r in rel_opts.get_all_related_many_to_many_objects(): 
    903                 if r.get_accessor_name() == rel_name and r.field is not f:                             
     911                if r.get_accessor_name() == rel_name and r.field is not f: 
    904912                    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())) 
    905913            for r in rel_opts.get_all_related_objects(): 
     
    11201128def execute_from_command_line(action_mapping=DEFAULT_ACTION_MAPPING): 
    11211129    # Parse the command-line arguments. optparse handles the dirty work. 
    1122     parser = DjangoOptionParser(get_usage(action_mapping)) 
     1130    parser = DjangoOptionParser(usage=get_usage(action_mapping), version=get_version()) 
    11231131    parser.add_option('--settings', 
    11241132        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.') 
  • django/branches/magic-removal/django/db/backends/ado_mssql/creation.py

    r1637 r2329  
    1818    'PositiveIntegerField': 'int CONSTRAINT [CK_int_pos_%(column)s] CHECK ([%(column)s] > 0)', 
    1919    'PositiveSmallIntegerField': 'smallint CONSTRAINT [CK_smallint_pos_%(column)s] CHECK ([%(column)s] > 0)', 
    20     'SlugField':         'varchar(50)', 
     20    'SlugField':         'varchar(%(maxlength)s)', 
    2121    'SmallIntegerField': 'smallint', 
    2222    'TextField':         'text', 
  • django/branches/magic-removal/django/db/backends/mysql/creation.py

    r1637 r2329  
    2222    'PositiveIntegerField': 'integer UNSIGNED', 
    2323    'PositiveSmallIntegerField': 'smallint UNSIGNED', 
    24     'SlugField':         'varchar(50)', 
     24    'SlugField':         'varchar(%(maxlength)s)', 
    2525    'SmallIntegerField': 'smallint', 
    2626    'TextField':         'longtext', 
  • django/branches/magic-removal/django/db/backends/postgresql/creation.py

    r1637 r2329  
    2222    'PositiveIntegerField': 'integer CHECK ("%(column)s" >= 0)', 
    2323    'PositiveSmallIntegerField': 'smallint CHECK ("%(column)s" >= 0)', 
    24     'SlugField':         'varchar(50)', 
     24    'SlugField':         'varchar(%(maxlength)s)', 
    2525    'SmallIntegerField': 'smallint', 
    2626    'TextField':         'text', 
  • django/branches/magic-removal/django/db/backends/sqlite3/creation.py

    r1637 r2329  
    2121    'PositiveIntegerField':         'integer unsigned', 
    2222    'PositiveSmallIntegerField':    'smallint unsigned', 
    23     'SlugField':                    'varchar(50)', 
     23    'SlugField':                    'varchar(%(maxlength)s)', 
    2424    'SmallIntegerField':            'smallint', 
    2525    'TextField':                    'text', 
  • django/branches/magic-removal/django/__init__.py

    r3 r2329  
     1VERSION = (0, 9, 1, 'SVN') 
  • django/branches/magic-removal/docs/model-api.txt

    r2116 r2329  
    411411    used in URLs. 
    412412 
    413     Implies ``maxlength=50`` and ``db_index=True``. 
     413    In the Django development version, you can specify ``maxlength``. If 
     414    ``maxlength`` is not specified, Django will use a default length of 50. In 
     415    previous Django versions, there's no way to override the length of 50. 
     416 
     417    Implies ``db_index=True``. 
    414418 
    415419    Accepts an extra option, ``prepopulate_from``, which is a list of fields