Django

Code

Show
Ignore:
Timestamp:
08/05/07 00:14:46 (1 year ago)
Author:
gwilson
Message:

Fixed #2101 -- Renamed maxlength argument to max_length for oldforms FormFields and db model Fields. This is fully backwards compatible at the moment since the legacy maxlength argument is still supported. Using maxlength will, however, issue a PendingDeprecationWarning when used.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/tests/regressiontests/invalid_admin_options/models.py

    r4273 r5803  
    1313#class BadAdminOption(models.Model): 
    1414#    "Test nonexistent admin option" 
    15 #    name = models.CharField(maxlength=30) 
     15#    name = models.CharField(max_length=30) 
    1616#     
    1717#    class Admin: 
     
    2323class ListDisplayBadOne(models.Model): 
    2424    "Test list_display, list_display must be a list or tuple" 
    25     first_name = models.CharField(maxlength=30) 
     25    first_name = models.CharField(max_length=30) 
    2626 
    2727    class Admin: 
     
    3333class ListDisplayBadTwo(models.Model): 
    3434    "Test list_display, list_display items must be attributes, methods or properties." 
    35     first_name = models.CharField(maxlength=30) 
     35    first_name = models.CharField(max_length=30) 
    3636 
    3737    class Admin: 
     
    4242class ListDisplayBadThree(models.Model): 
    4343    "Test list_display, list_display items can not be a ManyToManyField." 
    44     first_name = models.CharField(maxlength=30) 
     44    first_name = models.CharField(max_length=30) 
    4545    nick_names = models.ManyToManyField('ListDisplayGood') 
    4646 
     
    5353class ListDisplayGood(models.Model): 
    5454    "Test list_display, Admin list_display can be a attribute, method or property." 
    55     first_name = models.CharField(maxlength=30) 
     55    first_name = models.CharField(max_length=30) 
    5656     
    5757    def _last_name(self): 
     
    6767class ListDisplayLinksBadOne(models.Model): 
    6868    "Test list_display_links, item must be included in list_display." 
    69     first_name = models.CharField(maxlength=30) 
    70     last_name = models.CharField(maxlength=30) 
     69    first_name = models.CharField(max_length=30) 
     70    last_name = models.CharField(max_length=30) 
    7171     
    7272    class Admin: 
     
    7979class ListDisplayLinksBadTwo(models.Model): 
    8080    "Test list_display_links, must be a list or tuple." 
    81     first_name = models.CharField(maxlength=30) 
    82     last_name = models.CharField(maxlength=30) 
     81    first_name = models.CharField(max_length=30) 
     82    last_name = models.CharField(max_length=30) 
    8383     
    8484    class Admin: 
     
    9393#class ListDisplayLinksBadThree(models.Model): 
    9494#    "Test list_display_links, must define list_display to use list_display_links." 
    95 #    first_name = models.CharField(maxlength=30) 
    96 #    last_name = models.CharField(maxlength=30) 
     95#    first_name = models.CharField(max_length=30) 
     96#    last_name = models.CharField(max_length=30) 
    9797#     
    9898#    class Admin: 
     
    104104class ListDisplayLinksGood(models.Model): 
    105105    "Test list_display_links, Admin list_display_list can be a attribute, method or property." 
    106     first_name = models.CharField(maxlength=30) 
     106    first_name = models.CharField(max_length=30) 
    107107     
    108108    def _last_name(self): 
     
    119119class ListFilterBadOne(models.Model): 
    120120    "Test list_filter, must be a list or tuple." 
    121     first_name = models.CharField(maxlength=30) 
     121    first_name = models.CharField(max_length=30) 
    122122     
    123123    class Admin: 
     
    129129class ListFilterBadTwo(models.Model): 
    130130    "Test list_filter, must be a field not a property or method." 
    131     first_name = models.CharField(maxlength=30) 
     131    first_name = models.CharField(max_length=30) 
    132132     
    133133    def _last_name(self): 
     
    147147class DateHierarchyBadOne(models.Model): 
    148148    "Test date_hierarchy, must be a date or datetime field." 
    149     first_name = models.CharField(maxlength=30) 
     149    first_name = models.CharField(max_length=30) 
    150150    birth_day = models.DateField() 
    151151     
     
    159159class DateHierarchyBadTwo(models.Model): 
    160160    "Test date_hieracrhy, must be a field." 
    161     first_name = models.CharField(maxlength=30) 
     161    first_name = models.CharField(max_length=30) 
    162162    birth_day = models.DateField() 
    163163     
     
    170170class DateHierarchyGood(models.Model): 
    171171    "Test date_hieracrhy, must be a field." 
    172     first_name = models.CharField(maxlength=30) 
     172    first_name = models.CharField(max_length=30) 
    173173    birth_day = models.DateField() 
    174174     
     
    178178class SearchFieldsBadOne(models.Model): 
    179179    "Test search_fields, must be a list or tuple." 
    180     first_name = models.CharField(maxlength=30) 
     180    first_name = models.CharField(max_length=30) 
    181181     
    182182    class Admin: 
     
    189189class SearchFieldsBadTwo(models.Model): 
    190190    "Test search_fields, must be a field." 
    191     first_name = models.CharField(maxlength=30) 
     191    first_name = models.CharField(max_length=30) 
    192192 
    193193    def _last_name(self): 
     
    204204class SearchFieldsGood(models.Model): 
    205205    "Test search_fields, must be a list or tuple." 
    206     first_name = models.CharField(maxlength=30) 
    207     last_name = models.CharField(maxlength=30) 
     206    first_name = models.CharField(max_length=30) 
     207    last_name = models.CharField(max_length=30) 
    208208     
    209209    class Admin: 
     
    213213class JsBadOne(models.Model): 
    214214    "Test js, must be a list or tuple" 
    215     name = models.CharField(maxlength=30) 
     215    name = models.CharField(max_length=30) 
    216216     
    217217    class Admin: 
     
    224224class SaveAsBad(models.Model): 
    225225    "Test save_as, should be True or False" 
    226     name = models.CharField(maxlength=30) 
     226    name = models.CharField(max_length=30) 
    227227     
    228228    class Admin: 
     
    235235class SaveOnTopBad(models.Model): 
    236236    "Test save_on_top, should be True or False" 
    237     name = models.CharField(maxlength=30) 
     237    name = models.CharField(max_length=30) 
    238238     
    239239    class Admin: 
     
    246246class ListSelectRelatedBad(models.Model): 
    247247    "Test list_select_related, should be True or False" 
    248     name = models.CharField(maxlength=30) 
     248    name = models.CharField(max_length=30) 
    249249     
    250250    class Admin: 
     
    257257class ListPerPageBad(models.Model): 
    258258    "Test list_per_page, should be a positive integer value." 
    259     name = models.CharField(maxlength=30) 
     259    name = models.CharField(max_length=30) 
    260260     
    261261    class Admin: 
     
    268268class FieldsBadOne(models.Model): 
    269269    "Test fields, should be a tuple" 
    270     first_name = models.CharField(maxlength=30) 
    271     last_name = models.CharField(maxlength=30) 
     270    first_name = models.CharField(max_length=30) 
     271    last_name = models.CharField(max_length=30) 
    272272     
    273273    class Admin: 
     
    280280class FieldsBadTwo(models.Model): 
    281281    """Test fields, 'fields' dict option is required.""" 
    282     first_name = models.CharField(maxlength=30) 
    283     last_name = models.CharField(maxlength=30) 
     282    first_name = models.CharField(max_length=30) 
     283    last_name = models.CharField(max_length=30) 
    284284     
    285285    class Admin: 
     
    292292class FieldsBadThree(models.Model): 
    293293    """Test fields, 'classes' and 'description' are the only allowable extra dict options.""" 
    294     first_name = models.CharField(maxlength=30) 
    295     last_name = models.CharField(maxlength=30) 
     294    first_name = models.CharField(max_length=30) 
     295    last_name = models.CharField(max_length=30) 
    296296     
    297297    class Admin: 
     
    304304class FieldsGood(models.Model): 
    305305    "Test fields, working example" 
    306     first_name = models.CharField(maxlength=30) 
    307     last_name = models.CharField(maxlength=30) 
     306    first_name = models.CharField(max_length=30) 
     307    last_name = models.CharField(max_length=30) 
    308308    birth_day = models.DateField() 
    309309     
     
    316316class OrderingBad(models.Model): 
    317317    "Test ordering, must be a field." 
    318     first_name = models.CharField(maxlength=30) 
    319     last_name = models.CharField(maxlength=30) 
     318    first_name = models.CharField(max_length=30) 
     319    last_name = models.CharField(max_length=30) 
    320320     
    321321    class Admin: 
     
    329329#class ManagerBad(models.Model): 
    330330#    "Test manager, must be a manager object." 
    331 #    first_name = models.CharField(maxlength=30) 
     331#    first_name = models.CharField(max_length=30) 
    332332#     
    333333#    class Admin: