Permalink
Browse files

schema-evolution: update from HEAD (v5821)

git-svn-id: http://code.djangoproject.com/svn/django/branches/schema-evolution@5822 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
keredson committed Aug 6, 2007
1 parent 0af6ed0 commit 5aa017255827b2c06bd9a5f7f069828ef625da18
Showing with 1,067 additions and 486 deletions.
  1. +2 −0 AUTHORS
  2. +1 −1 django/contrib/admin/models.py
  3. +1 −1 django/contrib/admin/templatetags/admin_modify.py
  4. +2 −2 django/contrib/admin/views/doc.py
  5. +1 −1 django/contrib/admin/views/main.py
  6. +10 −10 django/contrib/auth/forms.py
  7. +7 −7 django/contrib/auth/models.py
  8. +4 −4 django/contrib/comments/models.py
  9. +3 −3 django/contrib/comments/views/comments.py
  10. +3 −3 django/contrib/contenttypes/models.py
  11. +3 −3 django/contrib/flatpages/models.py
  12. +2 −2 django/contrib/redirects/models.py
  13. +1 −1 django/contrib/sessions/models.py
  14. +2 −2 django/contrib/sites/models.py
  15. +15 −10 django/core/management.py
  16. +1 −1 django/core/validators.py
  17. +3 −3 django/db/backends/ado_mssql/creation.py
  18. +3 −3 django/db/backends/mysql/creation.py
  19. +3 −3 django/db/backends/mysql_old/creation.py
  20. +2 −2 django/db/backends/oracle/creation.py
  21. +3 −3 django/db/backends/postgresql/creation.py
  22. +3 −3 django/db/backends/sqlite3/creation.py
  23. +1 −1 django/db/backends/sqlite3/introspection.py
  24. +40 −9 django/db/models/fields/__init__.py
  25. +3 −0 django/db/models/fields/related.py
  26. +1 −1 django/newforms/extras/widgets.py
  27. +53 −3 django/newforms/fields.py
  28. +7 −6 django/newforms/forms.py
  29. +14 −8 django/newforms/models.py
  30. +13 −6 django/newforms/widgets.py
  31. +60 −56 django/oldforms/__init__.py
  32. +22 −9 django/template/defaulttags.py
  33. +0 −1 django/utils/encoding.py
  34. +67 −0 django/utils/maxlength.py
  35. +1 −1 docs/add_ons.txt
  36. +1 −4 docs/api_stability.txt
  37. +1 −1 docs/authentication.txt
  38. +10 −10 docs/contributing.txt
  39. +1 −1 docs/databases.txt
  40. +7 −7 docs/db-api.txt
  41. +1 −1 docs/email.txt
  42. +3 −0 docs/faq.txt
  43. +5 −5 docs/forms.txt
  44. +71 −59 docs/model-api.txt
  45. +140 −11 docs/newforms.txt
  46. +7 −5 docs/overview.txt
  47. +1 −1 docs/release_notes_0.95.txt
  48. +1 −1 docs/request_response.txt
  49. +1 −1 docs/sitemaps.txt
  50. +5 −5 docs/sites.txt
  51. +2 −2 docs/testing.txt
  52. +3 −3 docs/tutorial01.txt
  53. +1 −1 docs/tutorial02.txt
  54. +2 −1 docs/tutorial03.txt
  55. +3 −3 docs/tutorial04.txt
  56. +1 −1 docs/url_dispatch.txt
  57. +1 −1 tests/modeltests/basic/models.py
  58. +2 −2 tests/modeltests/choices/models.py
  59. +3 −3 tests/modeltests/custom_columns/models.py
  60. +5 −5 tests/modeltests/custom_managers/models.py
  61. +1 −1 tests/modeltests/custom_methods/models.py
  62. +4 −4 tests/modeltests/custom_pk/models.py
  63. +1 −1 tests/modeltests/field_defaults/models.py
  64. +1 −1 tests/modeltests/fixtures/models.py
  65. +4 −4 tests/modeltests/generic_relations/models.py
  66. +2 −2 tests/modeltests/get_latest/models.py
  67. +2 −2 tests/modeltests/get_object_or_404/models.py
  68. +2 −2 tests/modeltests/get_or_create/models.py
  69. +22 −22 tests/modeltests/invalid_models/models.py
  70. +1 −1 tests/modeltests/lookup/models.py
  71. +1 −1 tests/modeltests/m2m_and_m2o/models.py
  72. +4 −4 tests/modeltests/m2m_intermediary/models.py
  73. +2 −2 tests/modeltests/m2m_multiple/models.py
  74. +1 −1 tests/modeltests/m2m_recursive/models.py
  75. +1 −1 tests/modeltests/m2o_recursive/models.py
  76. +1 −1 tests/modeltests/m2o_recursive2/models.py
  77. +3 −3 tests/modeltests/manipulators/models.py
  78. +2 −2 tests/modeltests/many_to_many/models.py
  79. +3 −3 tests/modeltests/many_to_one/models.py
  80. +2 −2 tests/modeltests/many_to_one_null/models.py
  81. +27 −5 tests/modeltests/model_forms/models.py
  82. +2 −2 tests/modeltests/model_inheritance/models.py
  83. +2 −2 tests/modeltests/mutually_referential/models.py
  84. +6 −6 tests/modeltests/one_to_one/models.py
  85. +1 −1 tests/modeltests/or_lookups/models.py
  86. +1 −1 tests/modeltests/ordering/models.py
  87. +1 −1 tests/modeltests/pagination/models.py
  88. +2 −2 tests/modeltests/properties/models.py
  89. +8 −8 tests/modeltests/reserved_names/models.py
  90. +3 −3 tests/modeltests/reverse_lookup/models.py
  91. +2 −2 tests/modeltests/save_delete_hooks/models.py
  92. +8 −8 tests/modeltests/select_related/models.py
  93. +3 −3 tests/modeltests/serializers/models.py
  94. +2 −2 tests/modeltests/str/models.py
  95. +2 −2 tests/modeltests/transactions/models.py
  96. +1 −1 tests/modeltests/validation/models.py
  97. +1 −1 tests/regressiontests/bug639/models.py
  98. +1 −1 tests/regressiontests/datatypes/models.py
  99. +4 −4 tests/regressiontests/fixtures_regress/models.py
  100. +74 −7 tests/regressiontests/forms/tests.py
  101. +1 −1 tests/regressiontests/initial_sql_regress/models.py
  102. +37 −37 tests/regressiontests/invalid_admin_options/models.py
  103. +3 −3 tests/regressiontests/many_to_one_regress/models.py
  104. 0 tests/regressiontests/maxlength/__init__.py
  105. 0 tests/regressiontests/maxlength/models.py
  106. +160 −0 tests/regressiontests/maxlength/tests.py
  107. +1 −1 tests/regressiontests/model_regress/models.py
  108. +2 −2 tests/regressiontests/null_queries/models.py
  109. +3 −3 tests/regressiontests/one_to_one_regress/models.py
  110. +8 −8 tests/regressiontests/serializers_regress/models.py
  111. +6 −6 tests/regressiontests/string_lookup/models.py
View
@@ -45,6 +45,7 @@ answer newbie questions, and generally made Django that much better:
Marty Alchin <gulopine@gamemusic.org>
Daniel Alves Barbosa de Oliveira Vaz <danielvaz@gmail.com>
AgarFu <heaven@croasanaso.sytes.net>
+ Derek Anderson <public@kered.org>
Andreas
andy@jadedplanet.net
Fabrice Aneche <akh@nobugware.com>
@@ -96,6 +97,7 @@ answer newbie questions, and generally made Django that much better:
Maximillian Dornseif <md@hudora.de>
Jeremy Dunck <http://dunck.us/>
Andrew Durdin <adurdin@gmail.com>
+ dusk@woofle.net
Andy Dustman <farcepest@gmail.com>
Clint Ecker
enlight
@@ -18,7 +18,7 @@ class LogEntry(models.Model):
user = models.ForeignKey(User)
content_type = models.ForeignKey(ContentType, blank=True, null=True)
object_id = models.TextField(_('object id'), blank=True, null=True)
- object_repr = models.CharField(_('object repr'), maxlength=200)
+ object_repr = models.CharField(_('object repr'), max_length=200)
action_flag = models.PositiveSmallIntegerField(_('action flag'))
change_message = models.TextField(_('change message'), blank=True)
objects = LogEntryManager()
@@ -192,7 +192,7 @@ def auto_populated_field_script(auto_pop_fields, change = False):
t.append(u'document.getElementById("id_%s").onkeyup = function() {' \
' var e = document.getElementById("id_%s");' \
' if(!e._changed) { e.value = URLify(%s, %s);} }; ' % (
- f, field.name, add_values, field.maxlength))
+ f, field.name, add_values, field.max_length))
return u''.join(t)
auto_populated_field_script = register.simple_tag(auto_populated_field_script)
@@ -291,7 +291,7 @@ def get_return_data_type(func_name):
DATA_TYPE_MAPPING = {
'AutoField' : _('Integer'),
'BooleanField' : _('Boolean (Either True or False)'),
- 'CharField' : _('String (up to %(maxlength)s)'),
+ 'CharField' : _('String (up to %(max_length)s)'),
'CommaSeparatedIntegerField': _('Comma-separated integers'),
'DateField' : _('Date (without time)'),
'DateTimeField' : _('Date (with time)'),
@@ -310,7 +310,7 @@ def get_return_data_type(func_name):
'PhoneNumberField' : _('Phone number'),
'PositiveIntegerField' : _('Integer'),
'PositiveSmallIntegerField' : _('Integer'),
- 'SlugField' : _('String (up to %(maxlength)s)'),
+ 'SlugField' : _('String (up to %(max_length)s)'),
'SmallIntegerField' : _('Integer'),
'TextField' : _('Text'),
'TimeField' : _('Time'),
@@ -673,7 +673,7 @@ def get_ordering(self):
try:
attr = getattr(lookup_opts.admin.manager.model, field_name)
order_field = attr.admin_order_field
- except IndexError:
+ except AttributeError:
pass
else:
if not isinstance(f.rel, models.ManyToOneRel) or not f.null:
@@ -10,10 +10,10 @@ class UserCreationForm(oldforms.Manipulator):
"A form that creates a user, with no privileges, from the given username and password."
def __init__(self):
self.fields = (
- oldforms.TextField(field_name='username', length=30, maxlength=30, is_required=True,
+ oldforms.TextField(field_name='username', length=30, max_length=30, is_required=True,
validator_list=[validators.isAlphaNumeric, self.isValidUsername]),
- oldforms.PasswordField(field_name='password1', length=30, maxlength=60, is_required=True),
- oldforms.PasswordField(field_name='password2', length=30, maxlength=60, is_required=True,
+ oldforms.PasswordField(field_name='password1', length=30, max_length=60, is_required=True),
+ oldforms.PasswordField(field_name='password2', length=30, max_length=60, is_required=True,
validator_list=[validators.AlwaysMatchesOtherField('password1', _("The two password fields didn't match."))]),
)
@@ -42,9 +42,9 @@ def __init__(self, request=None):
"""
self.request = request
self.fields = [
- oldforms.TextField(field_name="username", length=15, maxlength=30, is_required=True,
+ oldforms.TextField(field_name="username", length=15, max_length=30, is_required=True,
validator_list=[self.isValidUser, self.hasCookiesEnabled]),
- oldforms.PasswordField(field_name="password", length=15, maxlength=30, is_required=True),
+ oldforms.PasswordField(field_name="password", length=15, max_length=30, is_required=True),
]
self.user_cache = None
@@ -111,11 +111,11 @@ class PasswordChangeForm(oldforms.Manipulator):
def __init__(self, user):
self.user = user
self.fields = (
- oldforms.PasswordField(field_name="old_password", length=30, maxlength=30, is_required=True,
+ oldforms.PasswordField(field_name="old_password", length=30, max_length=30, is_required=True,
validator_list=[self.isValidOldPassword]),
- oldforms.PasswordField(field_name="new_password1", length=30, maxlength=30, is_required=True,
+ oldforms.PasswordField(field_name="new_password1", length=30, max_length=30, is_required=True,
validator_list=[validators.AlwaysMatchesOtherField('new_password2', _("The two 'new password' fields didn't match."))]),
- oldforms.PasswordField(field_name="new_password2", length=30, maxlength=30, is_required=True),
+ oldforms.PasswordField(field_name="new_password2", length=30, max_length=30, is_required=True),
)
def isValidOldPassword(self, new_data, all_data):
@@ -133,8 +133,8 @@ class AdminPasswordChangeForm(oldforms.Manipulator):
def __init__(self, user):
self.user = user
self.fields = (
- oldforms.PasswordField(field_name='password1', length=30, maxlength=60, is_required=True),
- oldforms.PasswordField(field_name='password2', length=30, maxlength=60, is_required=True,
+ oldforms.PasswordField(field_name='password1', length=30, max_length=60, is_required=True),
+ oldforms.PasswordField(field_name='password2', length=30, max_length=60, is_required=True,
validator_list=[validators.AlwaysMatchesOtherField('password1', _("The two password fields didn't match."))]),
)
@@ -50,9 +50,9 @@ class Permission(models.Model):
Three basic permissions -- add, change and delete -- are automatically created for each Django model.
"""
- name = models.CharField(_('name'), maxlength=50)
+ name = models.CharField(_('name'), max_length=50)
content_type = models.ForeignKey(ContentType)
- codename = models.CharField(_('codename'), maxlength=100)
+ codename = models.CharField(_('codename'), max_length=100)
class Meta:
verbose_name = _('permission')
@@ -70,7 +70,7 @@ class Group(models.Model):
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.
"""
- name = models.CharField(_('name'), maxlength=80, unique=True)
+ name = models.CharField(_('name'), max_length=80, unique=True)
permissions = models.ManyToManyField(Permission, verbose_name=_('permissions'), blank=True, filter_interface=models.HORIZONTAL)
class Meta:
@@ -108,11 +108,11 @@ class User(models.Model):
Username and password are required. Other fields are optional.
"""
- 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)."))
- first_name = models.CharField(_('first name'), maxlength=30, blank=True)
- last_name = models.CharField(_('last name'), maxlength=30, blank=True)
+ 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)."))
+ first_name = models.CharField(_('first name'), max_length=30, blank=True)
+ last_name = models.CharField(_('last name'), max_length=30, blank=True)
email = models.EmailField(_('e-mail address'), blank=True)
- password = models.CharField(_('password'), maxlength=128, help_text=_("Use '[algo]$[salt]$[hexdigest]' or use the <a href=\"password/\">change password form</a>."))
+ password = models.CharField(_('password'), max_length=128, help_text=_("Use '[algo]$[salt]$[hexdigest]' or use the <a href=\"password/\">change password form</a>."))
is_staff = models.BooleanField(_('staff status'), default=False, help_text=_("Designates whether the user can log into this admin site."))
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."))
is_superuser = models.BooleanField(_('superuser status'), default=False, help_text=_("Designates that this user has all permissions without explicitly assigning them."))
@@ -65,8 +65,8 @@ class Comment(models.Model):
user = models.ForeignKey(User, raw_id_admin=True)
content_type = models.ForeignKey(ContentType)
object_id = models.IntegerField(_('object ID'))
- headline = models.CharField(_('headline'), maxlength=255, blank=True)
- comment = models.TextField(_('comment'), maxlength=3000)
+ headline = models.CharField(_('headline'), max_length=255, blank=True)
+ comment = models.TextField(_('comment'), max_length=3000)
rating1 = models.PositiveSmallIntegerField(_('rating #1'), blank=True, null=True)
rating2 = models.PositiveSmallIntegerField(_('rating #2'), blank=True, null=True)
rating3 = models.PositiveSmallIntegerField(_('rating #3'), blank=True, null=True)
@@ -164,8 +164,8 @@ class FreeComment(models.Model):
# A FreeComment is a comment by a non-registered user.
content_type = models.ForeignKey(ContentType)
object_id = models.IntegerField(_('object ID'))
- comment = models.TextField(_('comment'), maxlength=3000)
- person_name = models.CharField(_("person's name"), maxlength=50)
+ comment = models.TextField(_('comment'), max_length=3000)
+ person_name = models.CharField(_("person's name"), max_length=50)
submit_date = models.DateTimeField(_('date/time submitted'), auto_now_add=True)
is_public = models.BooleanField(_('is public'))
ip_address = models.IPAddressField(_('ip address'))
@@ -29,7 +29,7 @@ def get_validator_list(rating_num):
else:
return []
self.fields.extend([
- oldforms.LargeTextField(field_name="comment", maxlength=3000, is_required=True,
+ oldforms.LargeTextField(field_name="comment", max_length=3000, is_required=True,
validator_list=[self.hasNoProfanities]),
oldforms.RadioSelectField(field_name="rating1", choices=choices,
is_required=ratings_required and num_rating_choices > 0,
@@ -122,9 +122,9 @@ class PublicFreeCommentManipulator(oldforms.Manipulator):
"Manipulator that handles public free (unregistered) comments"
def __init__(self):
self.fields = (
- oldforms.TextField(field_name="person_name", maxlength=50, is_required=True,
+ oldforms.TextField(field_name="person_name", max_length=50, is_required=True,
validator_list=[self.hasNoProfanities]),
- oldforms.LargeTextField(field_name="comment", maxlength=3000, is_required=True,
+ oldforms.LargeTextField(field_name="comment", max_length=3000, is_required=True,
validator_list=[self.hasNoProfanities]),
)
@@ -32,9 +32,9 @@ def clear_cache(self):
CONTENT_TYPE_CACHE = {}
class ContentType(models.Model):
- name = models.CharField(maxlength=100)
- app_label = models.CharField(maxlength=100)
- model = models.CharField(_('python model class name'), maxlength=100)
+ name = models.CharField(max_length=100)
+ app_label = models.CharField(max_length=100)
+ model = models.CharField(_('python model class name'), max_length=100)
objects = ContentTypeManager()
class Meta:
verbose_name = _('content type')
@@ -4,12 +4,12 @@
from django.utils.translation import ugettext_lazy as _
class FlatPage(models.Model):
- url = models.CharField(_('URL'), maxlength=100, validator_list=[validators.isAlphaNumericURL], db_index=True,
+ url = models.CharField(_('URL'), max_length=100, validator_list=[validators.isAlphaNumericURL], db_index=True,
help_text=_("Example: '/about/contact/'. Make sure to have leading and trailing slashes."))
- title = models.CharField(_('title'), maxlength=200)
+ title = models.CharField(_('title'), max_length=200)
content = models.TextField(_('content'))
enable_comments = models.BooleanField(_('enable comments'))
- template_name = models.CharField(_('template name'), maxlength=70, blank=True,
+ template_name = models.CharField(_('template name'), max_length=70, blank=True,
help_text=_("Example: 'flatpages/contact_page.html'. If this isn't provided, the system will use 'flatpages/default.html'."))
registration_required = models.BooleanField(_('registration required'), help_text=_("If this is checked, only logged-in users will be able to view the page."))
sites = models.ManyToManyField(Site)
@@ -4,9 +4,9 @@
class Redirect(models.Model):
site = models.ForeignKey(Site, radio_admin=models.VERTICAL)
- old_path = models.CharField(_('redirect from'), maxlength=200, db_index=True,
+ old_path = models.CharField(_('redirect from'), max_length=200, db_index=True,
help_text=_("This should be an absolute path, excluding the domain name. Example: '/events/search/'."))
- new_path = models.CharField(_('redirect to'), maxlength=200, blank=True,
+ new_path = models.CharField(_('redirect to'), max_length=200, blank=True,
help_text=_("This can be either an absolute path (as above) or a full URL starting with 'http://'."))
class Meta:
@@ -65,7 +65,7 @@ class Session(models.Model):
the sessions documentation that is shipped with Django (also available
on the Django website).
"""
- session_key = models.CharField(_('session key'), maxlength=40, primary_key=True)
+ session_key = models.CharField(_('session key'), max_length=40, primary_key=True)
session_data = models.TextField(_('session data'))
expire_date = models.DateTimeField(_('expire date'))
objects = SessionManager()
@@ -12,8 +12,8 @@ def get_current(self):
return self.get(pk=sid)
class Site(models.Model):
- domain = models.CharField(_('domain name'), maxlength=100)
- name = models.CharField(_('display name'), maxlength=50)
+ domain = models.CharField(_('domain name'), max_length=100)
+ name = models.CharField(_('display name'), max_length=50)
objects = SiteManager()
class Meta:
db_table = 'django_site'
Oops, something went wrong.

0 comments on commit 5aa0172

Please sign in to comment.