Ticket #503: required.diff
File required.diff, 6.6 KB (added by , 19 years ago) |
---|
-
django/models/core.py
1 1 from django.core import meta, validators 2 2 3 3 class Site(meta.Model): 4 domain = meta.CharField( 'domain name', maxlength=100)5 name = meta.CharField( 'display name', maxlength=50)4 domain = meta.CharField(100, 'domain name') 5 name = meta.CharField(50, 'display name') 6 6 class META: 7 7 db_table = 'sites' 8 8 ordering = ('domain',) … … 16 16 return get_object(pk=SITE_ID) 17 17 18 18 class Package(meta.Model): 19 label = meta.CharField( maxlength=20, primary_key=True)20 name = meta.CharField( maxlength=30, unique=True)19 label = meta.CharField(20, primary_key=True) 20 name = meta.CharField(30, unique=True) 21 21 class META: 22 22 db_table = 'packages' 23 23 ordering = ('name',) … … 26 26 return self.name 27 27 28 28 class ContentType(meta.Model): 29 name = meta.CharField( maxlength=100)29 name = meta.CharField(100) 30 30 package = meta.ForeignKey(Package, db_column='package') 31 python_module_name = meta.CharField( maxlength=50)31 python_module_name = meta.CharField(50) 32 32 class META: 33 33 db_table = 'content_types' 34 34 ordering = ('package', 'name') … … 52 52 53 53 class Redirect(meta.Model): 54 54 site = meta.ForeignKey(Site, radio_admin=meta.VERTICAL) 55 old_path = meta.CharField( 'redirect from', maxlength=200, db_index=True,55 old_path = meta.CharField(200, 'redirect from', db_index=True, 56 56 help_text="This should be an absolute path, excluding the domain name. Example: '/events/search/'.") 57 new_path = meta.CharField( 'redirect to', maxlength=200, blank=True,57 new_path = meta.CharField(200, 'redirect to', blank=True, 58 58 help_text="This can be either an absolute path (as above) or a full URL starting with 'http://'.") 59 59 class META: 60 60 db_table = 'redirects' … … 69 69 return "%s ---> %s" % (self.old_path, self.new_path) 70 70 71 71 class FlatFile(meta.Model): 72 url = meta.CharField( 'URL', maxlength=100, validator_list=[validators.isAlphaNumericURL],72 url = meta.CharField(100, 'URL', validator_list=[validators.isAlphaNumericURL], 73 73 help_text="Example: '/about/contact/'. Make sure to have leading and trailing slashes.") 74 title = meta.CharField( maxlength=200)74 title = meta.CharField(200) 75 75 content = meta.TextField() 76 76 enable_comments = meta.BooleanField() 77 template_name = meta.CharField( maxlength=70, blank=True,77 template_name = meta.CharField(70, blank=True, 78 78 help_text="Example: 'flatfiles/contact_page'. If this isn't provided, the system will use 'flatfiles/default'.") 79 79 registration_required = meta.BooleanField(help_text="If this is checked, only logged-in users will be able to view the page.") 80 80 sites = meta.ManyToManyField(Site) … … 101 101 import cPickle as pickle 102 102 103 103 class Session(meta.Model): 104 session_key = meta.CharField( maxlength=40, primary_key=True)104 session_key = meta.CharField(40, primary_key=True) 105 105 session_data = meta.TextField() 106 106 expire_date = meta.DateTimeField() 107 107 class META: -
django/models/auth.py
2 2 from django.models import core 3 3 4 4 class Permission(meta.Model): 5 name = meta.CharField( maxlength=50)5 name = meta.CharField(50) 6 6 package = meta.ForeignKey(core.Package, db_column='package') 7 codename = meta.CharField( maxlength=100)7 codename = meta.CharField(100) 8 8 class META: 9 9 unique_together = (('package', 'codename'),) 10 10 ordering = ('package', 'codename') … … 13 13 return "%s | %s" % (self.package, self.name) 14 14 15 15 class Group(meta.Model): 16 name = meta.CharField( maxlength=80, unique=True)16 name = meta.CharField(80, unique=True) 17 17 permissions = meta.ManyToManyField(Permission, blank=True, filter_interface=meta.HORIZONTAL) 18 18 class META: 19 19 ordering = ('name',) … … 25 25 return self.name 26 26 27 27 class User(meta.Model): 28 username = meta.CharField( maxlength=30, unique=True, validator_list=[validators.isAlphaNumeric])29 first_name = meta.CharField( maxlength=30, blank=True)30 last_name = meta.CharField( maxlength=30, blank=True)28 username = meta.CharField(30, unique=True, validator_list=[validators.isAlphaNumeric]) 29 first_name = meta.CharField(30, blank=True) 30 last_name = meta.CharField(30, blank=True) 31 31 email = meta.EmailField('e-mail address', blank=True) 32 password_md5 = meta.CharField( 'password', maxlength=32, help_text="Use an MD5 hash -- not the raw password.")32 password_md5 = meta.CharField(32, 'password', help_text="Use an MD5 hash -- not the raw password.") 33 33 is_staff = meta.BooleanField('staff status', help_text="Designates whether the user can log into this admin site.") 34 34 is_active = meta.BooleanField('active', default=True) 35 35 is_superuser = meta.BooleanField('superuser status') … … 182 182 user = meta.ForeignKey(User) 183 183 content_type = meta.ForeignKey(core.ContentType, blank=True, null=True) # TODO: content_type_id name? 184 184 object_id = meta.TextField(blank=True, null=True) 185 object_repr = meta.CharField( maxlength=200)185 object_repr = meta.CharField(200) 186 186 action_flag = meta.PositiveSmallIntegerField() 187 187 change_message = meta.TextField(blank=True) 188 188 class META: -
django/core/meta/fields.py
287 287 return [formfields.CheckboxField] 288 288 289 289 class CharField(Field): 290 def __init__(self, maxlength, *args, **kwargs): 291 kwargs['maxlength'] = maxlength 292 Field.__init__(self, *args, **kwargs) 293 290 294 def get_manipulator_field_objs(self): 291 295 return [formfields.TextField] 292 296 … … 422 426 423 427 class FloatField(Field): 424 428 empty_strings_allowed = False 425 def __init__(self, verbose_name=None, name=None, max_digits=None, decimal_places=None, **kwargs): 426 self.max_digits, self.decimal_places = max_digits, decimal_places 427 Field.__init__(self, verbose_name, name, **kwargs) 429 def __init__(self, max_digits, decimal_places, *args, **kwargs): 430 self.max_digits = max_digits 431 self.decimal_places = decimal_places 432 Field.__init__(self, *args, **kwargs) 428 433 429 434 def get_manipulator_field_objs(self): 430 435 return [curry(formfields.FloatField, max_digits=self.max_digits, decimal_places=self.decimal_places)]