Django

Code

Changeset 5822

Show
Ignore:
Timestamp:
08/06/07 11:50:17 (1 year ago)
Author:
danderson
Message:

schema-evolution: update from HEAD (v5821)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/schema-evolution/AUTHORS

    r5788 r5822  
    4646    Daniel Alves Barbosa de Oliveira Vaz <danielvaz@gmail.com> 
    4747    AgarFu <heaven@croasanaso.sytes.net> 
     48    Derek Anderson <public@kered.org> 
    4849    Andreas 
    4950    andy@jadedplanet.net 
     
    9798    Jeremy Dunck <http://dunck.us/> 
    9899    Andrew Durdin <adurdin@gmail.com> 
     100    dusk@woofle.net 
    99101    Andy Dustman <farcepest@gmail.com> 
    100102    Clint Ecker 
  • django/branches/schema-evolution/django/contrib/admin/models.py

    r5734 r5822  
    1919    content_type = models.ForeignKey(ContentType, blank=True, null=True) 
    2020    object_id = models.TextField(_('object id'), blank=True, null=True) 
    21     object_repr = models.CharField(_('object repr'), maxlength=200) 
     21    object_repr = models.CharField(_('object repr'), max_length=200) 
    2222    action_flag = models.PositiveSmallIntegerField(_('action flag')) 
    2323    change_message = models.TextField(_('change message'), blank=True) 
  • django/branches/schema-evolution/django/contrib/admin/templatetags/admin_modify.py

    r5734 r5822  
    193193                     ' var e = document.getElementById("id_%s");' \ 
    194194                     ' if(!e._changed) { e.value = URLify(%s, %s);} }; ' % ( 
    195                      f, field.name, add_values, field.maxlength)) 
     195                     f, field.name, add_values, field.max_length)) 
    196196    return u''.join(t) 
    197197auto_populated_field_script = register.simple_tag(auto_populated_field_script) 
  • django/branches/schema-evolution/django/contrib/admin/views/doc.py

    r5734 r5822  
    292292    'AutoField'                 : _('Integer'), 
    293293    'BooleanField'              : _('Boolean (Either True or False)'), 
    294     'CharField'                 : _('String (up to %(maxlength)s)'), 
     294    'CharField'                 : _('String (up to %(max_length)s)'), 
    295295    'CommaSeparatedIntegerField': _('Comma-separated integers'), 
    296296    'DateField'                 : _('Date (without time)'), 
     
    311311    'PositiveIntegerField'      : _('Integer'), 
    312312    'PositiveSmallIntegerField' : _('Integer'), 
    313     'SlugField'                 : _('String (up to %(maxlength)s)'), 
     313    'SlugField'                 : _('String (up to %(max_length)s)'), 
    314314    'SmallIntegerField'         : _('Integer'), 
    315315    'TextField'                 : _('Text'), 
  • django/branches/schema-evolution/django/contrib/admin/views/main.py

    r5734 r5822  
    674674                        attr = getattr(lookup_opts.admin.manager.model, field_name) 
    675675                        order_field = attr.admin_order_field 
    676                     except IndexError: 
     676                    except AttributeError: 
    677677                        pass 
    678678                else: 
  • django/branches/schema-evolution/django/contrib/auth/forms.py

    r5734 r5822  
    1111    def __init__(self): 
    1212        self.fields = ( 
    13             oldforms.TextField(field_name='username', length=30, maxlength=30, is_required=True, 
     13            oldforms.TextField(field_name='username', length=30, max_length=30, is_required=True, 
    1414                validator_list=[validators.isAlphaNumeric, self.isValidUsername]), 
    15             oldforms.PasswordField(field_name='password1', length=30, maxlength=60, is_required=True), 
    16             oldforms.PasswordField(field_name='password2', length=30, maxlength=60, is_required=True, 
     15            oldforms.PasswordField(field_name='password1', length=30, max_length=60, is_required=True), 
     16            oldforms.PasswordField(field_name='password2', length=30, max_length=60, is_required=True, 
    1717                validator_list=[validators.AlwaysMatchesOtherField('password1', _("The two password fields didn't match."))]), 
    1818        ) 
     
    4343        self.request = request 
    4444        self.fields = [ 
    45             oldforms.TextField(field_name="username", length=15, maxlength=30, is_required=True, 
     45            oldforms.TextField(field_name="username", length=15, max_length=30, is_required=True, 
    4646                validator_list=[self.isValidUser, self.hasCookiesEnabled]), 
    47             oldforms.PasswordField(field_name="password", length=15, maxlength=30, is_required=True), 
     47            oldforms.PasswordField(field_name="password", length=15, max_length=30, is_required=True), 
    4848        ] 
    4949        self.user_cache = None 
     
    112112        self.user = user 
    113113        self.fields = ( 
    114             oldforms.PasswordField(field_name="old_password", length=30, maxlength=30, is_required=True, 
     114            oldforms.PasswordField(field_name="old_password", length=30, max_length=30, is_required=True, 
    115115                validator_list=[self.isValidOldPassword]), 
    116             oldforms.PasswordField(field_name="new_password1", length=30, maxlength=30, is_required=True, 
     116            oldforms.PasswordField(field_name="new_password1", length=30, max_length=30, is_required=True, 
    117117                validator_list=[validators.AlwaysMatchesOtherField('new_password2', _("The two 'new password' fields didn't match."))]), 
    118             oldforms.PasswordField(field_name="new_password2", length=30, maxlength=30, is_required=True), 
     118            oldforms.PasswordField(field_name="new_password2", length=30, max_length=30, is_required=True), 
    119119        ) 
    120120 
     
    134134        self.user = user 
    135135        self.fields = ( 
    136             oldforms.PasswordField(field_name='password1', length=30, maxlength=60, is_required=True), 
    137             oldforms.PasswordField(field_name='password2', length=30, maxlength=60, is_required=True, 
     136            oldforms.PasswordField(field_name='password1', length=30, max_length=60, is_required=True), 
     137            oldforms.PasswordField(field_name='password2', length=30, max_length=60, is_required=True, 
    138138                validator_list=[validators.AlwaysMatchesOtherField('password1', _("The two password fields didn't match."))]), 
    139139        ) 
  • django/branches/schema-evolution/django/contrib/auth/models.py

    r5788 r5822  
    5151    Three basic permissions -- add, change and delete -- are automatically created for each Django model. 
    5252    """ 
    53     name = models.CharField(_('name'), maxlength=50) 
     53    name = models.CharField(_('name'), max_length=50) 
    5454    content_type = models.ForeignKey(ContentType) 
    55     codename = models.CharField(_('codename'), maxlength=100) 
     55    codename = models.CharField(_('codename'), max_length=100) 
    5656 
    5757    class Meta: 
     
    7171    Beyond permissions, groups are a convenient way to categorize users to apply some label, or extended functionality, to them. For example, you could create a group 'Special users', and you could write code that would do special things to those users -- such as giving them access to a members-only portion of your site, or sending them members-only e-mail messages. 
    7272    """ 
    73     name = models.CharField(_('name'), maxlength=80, unique=True) 
     73    name = models.CharField(_('name'), max_length=80, unique=True) 
    7474    permissions = models.ManyToManyField(Permission, verbose_name=_('permissions'), blank=True, filter_interface=models.HORIZONTAL) 
    7575 
     
    109109    Username and password are required. Other fields are optional. 
    110110    """ 
    111     username = models.CharField(_('username'), maxlength=30, unique=True, validator_list=[validators.isAlphaNumeric], help_text=_("Required. 30 characters or fewer. Alphanumeric characters only (letters, digits and underscores).")) 
    112     first_name = models.CharField(_('first name'), maxlength=30, blank=True) 
    113     last_name = models.CharField(_('last name'), maxlength=30, blank=True) 
     111    username = models.CharField(_('username'), max_length=30, unique=True, validator_list=[validators.isAlphaNumeric], help_text=_("Required. 30 characters or fewer. Alphanumeric characters only (letters, digits and underscores).")) 
     112    first_name = models.CharField(_('first name'), max_length=30, blank=True) 
     113    last_name = models.CharField(_('last name'), max_length=30, blank=True) 
    114114    email = models.EmailField(_('e-mail address'), blank=True) 
    115     password = models.CharField(_('password'), maxlength=128, help_text=_("Use '[algo]$[salt]$[hexdigest]' or use the <a href=\"password/\">change password form</a>.")) 
     115    password = models.CharField(_('password'), max_length=128, help_text=_("Use '[algo]$[salt]$[hexdigest]' or use the <a href=\"password/\">change password form</a>.")) 
    116116    is_staff = models.BooleanField(_('staff status'), default=False, help_text=_("Designates whether the user can log into this admin site.")) 
    117117    is_active = models.BooleanField(_('active'), default=True, help_text=_("Designates whether this user can log into the Django admin. Unselect this instead of deleting accounts.")) 
  • django/branches/schema-evolution/django/contrib/comments/models.py

    r5734 r5822  
    6666    content_type = models.ForeignKey(ContentType) 
    6767    object_id = models.IntegerField(_('object ID')) 
    68     headline = models.CharField(_('headline'), maxlength=255, blank=True) 
    69     comment = models.TextField(_('comment'), maxlength=3000) 
     68    headline = models.CharField(_('headline'), max_length=255, blank=True) 
     69    comment = models.TextField(_('comment'), max_length=3000) 
    7070    rating1 = models.PositiveSmallIntegerField(_('rating #1'), blank=True, null=True) 
    7171    rating2 = models.PositiveSmallIntegerField(_('rating #2'), blank=True, null=True) 
     
    165165    content_type = models.ForeignKey(ContentType) 
    166166    object_id = models.IntegerField(_('object ID')) 
    167     comment = models.TextField(_('comment'), maxlength=3000) 
    168     person_name = models.CharField(_("person's name"), maxlength=50) 
     167    comment = models.TextField(_('comment'), max_length=3000) 
     168    person_name = models.CharField(_("person's name"), max_length=50) 
    169169    submit_date = models.DateTimeField(_('date/time submitted'), auto_now_add=True) 
    170170    is_public = models.BooleanField(_('is public')) 
  • django/branches/schema-evolution/django/contrib/comments/views/comments.py

    r5734 r5822  
    3030                return [] 
    3131        self.fields.extend([ 
    32             oldforms.LargeTextField(field_name="comment", maxlength=3000, is_required=True, 
     32            oldforms.LargeTextField(field_name="comment", max_length=3000, is_required=True, 
    3333                validator_list=[self.hasNoProfanities]), 
    3434            oldforms.RadioSelectField(field_name="rating1", choices=choices, 
     
    123123    def __init__(self): 
    124124        self.fields = ( 
    125             oldforms.TextField(field_name="person_name", maxlength=50, is_required=True, 
     125            oldforms.TextField(field_name="person_name", max_length=50, is_required=True, 
    126126                validator_list=[self.hasNoProfanities]), 
    127             oldforms.LargeTextField(field_name="comment", maxlength=3000, is_required=True, 
     127            oldforms.LargeTextField(field_name="comment", max_length=3000, is_required=True, 
    128128                validator_list=[self.hasNoProfanities]), 
    129129        ) 
  • django/branches/schema-evolution/django/contrib/contenttypes/models.py

    r5734 r5822  
    3333 
    3434class ContentType(models.Model): 
    35     name = models.CharField(maxlength=100) 
    36     app_label = models.CharField(maxlength=100) 
    37     model = models.CharField(_('python model class name'), maxlength=100) 
     35    name = models.CharField(max_length=100) 
     36    app_label = models.CharField(max_length=100) 
     37    model = models.CharField(_('python model class name'), max_length=100) 
    3838    objects = ContentTypeManager() 
    3939    class Meta: 
  • django/branches/schema-evolution/django/contrib/flatpages/models.py

    r5734 r5822  
    55 
    66class FlatPage(models.Model): 
    7     url = models.CharField(_('URL'), maxlength=100, validator_list=[validators.isAlphaNumericURL], db_index=True, 
     7    url = models.CharField(_('URL'), max_length=100, validator_list=[validators.isAlphaNumericURL], db_index=True, 
    88        help_text=_("Example: '/about/contact/'. Make sure to have leading and trailing slashes.")) 
    9     title = models.CharField(_('title'), maxlength=200) 
     9    title = models.CharField(_('title'), max_length=200) 
    1010    content = models.TextField(_('content')) 
    1111    enable_comments = models.BooleanField(_('enable comments')) 
    12     template_name = models.CharField(_('template name'), maxlength=70, blank=True, 
     12    template_name = models.CharField(_('template name'), max_length=70, blank=True, 
    1313        help_text=_("Example: 'flatpages/contact_page.html'. If this isn't provided, the system will use 'flatpages/default.html'.")) 
    1414    registration_required = models.BooleanField(_('registration required'), help_text=_("If this is checked, only logged-in users will be able to view the page.")) 
  • django/branches/schema-evolution/django/contrib/redirects/models.py

    r5734 r5822  
    55class Redirect(models.Model): 
    66    site = models.ForeignKey(Site, radio_admin=models.VERTICAL) 
    7     old_path = models.CharField(_('redirect from'), maxlength=200, db_index=True, 
     7    old_path = models.CharField(_('redirect from'), max_length=200, db_index=True, 
    88        help_text=_("This should be an absolute path, excluding the domain name. Example: '/events/search/'.")) 
    9     new_path = models.CharField(_('redirect to'), maxlength=200, blank=True, 
     9    new_path = models.CharField(_('redirect to'), max_length=200, blank=True, 
    1010        help_text=_("This can be either an absolute path (as above) or a full URL starting with 'http://'.")) 
    1111 
  • django/branches/schema-evolution/django/contrib/sessions/models.py

    r5734 r5822  
    6666    on the Django website). 
    6767    """ 
    68     session_key = models.CharField(_('session key'), maxlength=40, primary_key=True) 
     68    session_key = models.CharField(_('session key'), max_length=40, primary_key=True) 
    6969    session_data = models.TextField(_('session data')) 
    7070    expire_date = models.DateTimeField(_('expire date')) 
  • django/branches/schema-evolution/django/contrib/sites/models.py

    r5734 r5822  
    1313 
    1414class Site(models.Model): 
    15     domain = models.CharField(_('domain name'), maxlength=100) 
    16     name = models.CharField(_('display name'), maxlength=50) 
     15    domain = models.CharField(_('domain name'), max_length=100) 
     16    name = models.CharField(_('display name'), max_length=50) 
    1717    objects = SiteManager() 
    1818    class Meta: 
  • django/branches/schema-evolution/django/core/management.py

    r5821 r5822  
    10651065                    extra_params.update(new_params) 
    10661066 
    1067                 # Add maxlength for all CharFields. 
     1067                # Add max_length for all CharFields. 
    10681068                if field_type == 'CharField' and row[3]: 
    1069                     extra_params['maxlength'] = row[3] 
     1069                    extra_params['max_length'] = row[3] 
    10701070 
    10711071                if field_type == 'DecimalField': 
     
    11421142            if f.name == 'id' and not f.primary_key and opts.pk.name == 'id': 
    11431143                e.add(opts, '"%s": You can\'t use "id" as a field name, because each model automatically gets an "id" field if none of the fields have primary_key=True. You need to either remove/rename your "id" field or add primary_key=True to a field.' % f.name) 
    1144             if isinstance(f, models.CharField) and f.maxlength in (None, 0): 
    1145                 e.add(opts, '"%s": CharFields require a "maxlength" attribute.' % f.name) 
     1144            if isinstance(f, models.CharField) and f.max_length in (None, 0): 
     1145                e.add(opts, '"%s": CharFields require a "max_length" attribute.' % f.name) 
    11461146            if isinstance(f, models.DecimalField): 
    11471147                if f.decimal_places is None: 
     
    11681168                e.add(opts, '"%s": "db_index" should be either None, True or False.' % f.name) 
    11691169 
    1170             # Check that maxlength <= 255 if using older MySQL versions. 
     1170            # Check that max_length <= 255 if using older MySQL versions. 
    11711171            if settings.DATABASE_ENGINE == 'mysql': 
    11721172                db_version = connection.get_server_version() 
    1173                 if db_version < (5, 0, 3) and isinstance(f, (models.CharField, models.CommaSeparatedIntegerField, models.SlugField)) and f.maxlength > 255: 
    1174                     e.add(opts, '"%s": %s cannot have a "maxlength" greater than 255 when you are using a version of MySQL prior to 5.0.3 (you are using %s).' % (f.name, f.__class__.__name__, '.'.join([str(n) for n in db_version[:3]]))) 
     1173                if db_version < (5, 0, 3) and isinstance(f, (models.CharField, models.CommaSeparatedIntegerField, models.SlugField)) and f.max_length > 255: 
     1174                    e.add(opts, '"%s": %s cannot have a "max_length" greater than 255 when you are using a version of MySQL prior to 5.0.3 (you are using %s).' % (f.name, f.__class__.__name__, '.'.join([str(n) for n in db_version[:3]]))) 
    11751175 
    11761176            # Check to see if the related field will clash with any 
     
    14071407    fields = ( 
    14081408        # "key" is a reserved word in MySQL, so use "cache_key" instead. 
    1409         models.CharField(name='cache_key', maxlength=255, unique=True, primary_key=True), 
     1409        models.CharField(name='cache_key', max_length=255, unique=True, primary_key=True), 
    14101410        models.TextField(name='value'), 
    14111411        models.DateTimeField(name='expires', db_index=True), 
     
    14551455    except ImportError: 
    14561456        import code 
     1457        # Set up a dictionary to serve as the environment for the shell, so 
     1458        # that tab completion works on objects that are imported at runtime. 
     1459        # See ticket 5082. 
     1460        imported_objects = {} 
    14571461        try: # Try activating rlcompleter, because it's handy. 
    14581462            import readline 
     
    14631467            # we already know 'readline' was imported successfully. 
    14641468            import rlcompleter 
     1469            readline.set_completer(rlcompleter.Completer(imported_objects).complete) 
    14651470            readline.parse_and_bind("tab:complete") 
    1466         code.interact(
     1471        code.interact(local=imported_objects
    14671472run_shell.args = '[--plain]' 
    14681473 
     
    15791584                                (format, fixture_name, humanize(fixture_dir)) 
    15801585                        try: 
    1581                             objects = serializers.deserialize(format, fixture) 
     1586                            objects = serializers.deserialize(format, fixture) 
    15821587                            for obj in objects: 
    15831588                                count[0] += 1 
  • django/branches/schema-evolution/django/core/validators.py

    r5734 r5822  
    443443        float(data) 
    444444    except ValueError: 
    445         raise ValidationError, ugettext("Please enter a valid floating point number.") 
     445        raise ValidationError, _("Please enter a valid floating point number.") 
    446446 
    447447class HasAllowableSize(object): 
  • django/branches/schema-evolution/django/db/backends/ado_mssql/creation.py

    r5734 r5822  
    22    'AutoField':         'int IDENTITY (1, 1)', 
    33    'BooleanField':      'bit', 
    4     'CharField':         'varchar(%(maxlength)s)', 
    5     'CommaSeparatedIntegerField': 'varchar(%(maxlength)s)', 
     4    'CharField':         'varchar(%(max_length)s)', 
     5    'CommaSeparatedIntegerField': 'varchar(%(max_length)s)', 
    66    'DateField':         'smalldatetime', 
    77    'DateTimeField':     'smalldatetime', 
     
    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(%(maxlength)s)', 
     20    'SlugField':         'varchar(%(max_length)s)', 
    2121    'SmallIntegerField': 'smallint', 
    2222    'TextField':         'text', 
  • django/branches/schema-evolution/django/db/backends/mysql/creation.py

    r5734 r5822  
    66    'AutoField':         'integer AUTO_INCREMENT', 
    77    'BooleanField':      'bool', 
    8     'CharField':         'varchar(%(maxlength)s)', 
    9     'CommaSeparatedIntegerField': 'varchar(%(maxlength)s)', 
     8    'CharField':         'varchar(%(max_length)s)', 
     9    'CommaSeparatedIntegerField': 'varchar(%(max_length)s)', 
    1010    'DateField':         'date', 
    1111    'DateTimeField':     'datetime', 
     
    2222    'PositiveIntegerField': 'integer UNSIGNED', 
    2323    'PositiveSmallIntegerField': 'smallint UNSIGNED', 
    24     'SlugField':         'varchar(%(maxlength)s)', 
     24    'SlugField':         'varchar(%(max_length)s)', 
    2525    'SmallIntegerField': 'smallint', 
    2626    'TextField':         'longtext', 
  • django/branches/schema-evolution/django/db/backends/mysql_old/creation.py

    r5734 r5822  
    66    'AutoField':         'integer AUTO_INCREMENT', 
    77    'BooleanField':      'bool', 
    8     'CharField':         'varchar(%(maxlength)s)', 
    9     'CommaSeparatedIntegerField': 'varchar(%(maxlength)s)', 
     8    'CharField':         'varchar(%(max_length)s)', 
     9    'CommaSeparatedIntegerField': 'varchar(%(max_length)s)', 
    1010    'DateField':         'date', 
    1111    'DateTimeField':     'datetime', 
     
    2222    'PositiveIntegerField': 'integer UNSIGNED', 
    2323    'PositiveSmallIntegerField': 'smallint UNSIGNED', 
    24     'SlugField':         'varchar(%(maxlength)s)', 
     24    'SlugField':         'varchar(%(max_length)s)', 
    2525    'SmallIntegerField': 'smallint', 
    2626    'TextField':         'longtext', 
  • django/branches/schema-evolution/django/db/backends/oracle/creation.py

    r5734 r5822  
    99    'AutoField':                    'NUMBER(11)', 
    1010    'BooleanField':                 'NUMBER(1) CHECK (%(column)s IN (0,1))', 
    11     'CharField':                    'NVARCHAR2(%(maxlength)s)', 
    12     'CommaSeparatedIntegerField':   'VARCHAR2(%(maxlength)s)', 
     11    'CharField':                    'NVARCHAR2(%(max_length)s)', 
     12    'CommaSeparatedIntegerField':   'VARCHAR2(%(max_length)s)', 
    1313    'DateField':                    'DATE', 
    1414    'DateTimeField':                'TIMESTAMP', 
  • django/branches/schema-evolution/django/db/backends/postgresql/creation.py

    r5734 r5822  
    66    'AutoField':         'serial', 
    77    'BooleanField':      'boolean', 
    8     'CharField':         'varchar(%(maxlength)s)', 
    9     'CommaSeparatedIntegerField': 'varchar(%(maxlength)s)', 
     8    'CharField':         'varchar(%(max_length)s)', 
     9    'CommaSeparatedIntegerField': 'varchar(%(max_length)s)', 
    1010    'DateField':         'date', 
    1111    'DateTimeField':     'timestamp with time zone', 
     
    2222    'PositiveIntegerField': 'integer CHECK ("%(column)s" >= 0)', 
    2323    'PositiveSmallIntegerField': 'smallint CHECK ("%(column)s" >= 0)', 
    24     'SlugField':         'varchar(%(maxlength)s)', 
     24    'SlugField':         'varchar(%(max_length)s)', 
    2525    'SmallIntegerField': 'smallint', 
    2626    'TextField':         'text', 
  • django/branches/schema-evolution/django/db/backends/sqlite3/creation.py

    r5734 r5822  
    55    'AutoField':                    'integer', 
    66    'BooleanField':                 'bool', 
    7     'CharField':                    'varchar(%(maxlength)s)', 
    8     'CommaSeparatedIntegerField':   'varchar(%(maxlength)s)', 
     7    'CharField':                    'varchar(%(max_length)s)', 
     8    'CommaSeparatedIntegerField':   'varchar(%(max_length)s)', 
    99    'DateField':                    'date', 
    1010    'DateTimeField':                'datetime', 
     
    2121    'PositiveIntegerField':         'integer unsigned', 
    2222    'PositiveSmallIntegerField':    'smallint unsigned', 
    23     'SlugField':                    'varchar(%(maxlength)s)', 
     23    'SlugField':                    'varchar(%(max_length)s)', 
    2424    'SmallIntegerField':            'smallint', 
    2525    'TextField':                    'text', 
  • django/branches/schema-evolution/django/db/backends/sqlite3/introspection.py

    r5787 r5822  <