django1/django/contrib
Andrew Gorcester f9ab543720 Fixed #20084 -- Provided option to validate formset max_num on server.
This is provided as a new "validate_max" formset_factory option defaulting to
False, since the non-validating behavior of max_num is longstanding, and there
is certainly code relying on it. (In fact, even the Django admin relies on it
for the case where there are more existing inlines than the given max_num). It
may be that at some point we want to deprecate validate_max=False and
eventually remove the option, but this commit takes no steps in that direction.

This also fixes the DoS-prevention absolute_max enforcement so that it causes a
form validation error rather than an IndexError, and ensures that absolute_max
is always 1000 more than max_num, to prevent surprising changes in behavior
with max_num close to absolute_max.

Lastly, this commit fixes the previous inconsistency between a regular formset
and a model formset in the precedence of max_num and initial data. Previously
in a regular formset, if the provided initial data was longer than max_num, it
was truncated; in a model formset, all initial forms would be displayed
regardless of max_num. Now regular formsets are the same as model formsets; all
initial forms are displayed, even if more than max_num. (But if validate_max is
True, submitting these forms will result in a "too many forms" validation
error!) This combination of behaviors was chosen to keep the max_num validation
simple and consistent, and avoid silent data loss due to truncation of initial
data.

Thanks to Preston for discussion of the design choices.
2013-03-21 01:27:24 -07:00
..
admin Fixed #19972 -- Fixed overflow issue in admin changelist pages. 2013-03-20 17:00:25 +01:00
admindocs Merged contrib translations from 1.5 branch 2013-02-26 21:51:06 +01:00
auth Fixed #17051 -- Removed some 'invalid' field error messages 2013-03-14 17:03:43 +01:00
comments Deprecated django.contrib.comments. 2013-03-11 15:38:40 -05:00
contenttypes Fixed #20084 -- Provided option to validate formset max_num on server. 2013-03-21 01:27:24 -07:00
flatpages Merged contrib translations from 1.5 branch 2013-02-26 21:51:06 +01:00
formtools Merged contrib translations from 1.5 branch 2013-02-26 21:51:06 +01:00
gis Fixed #18003 -- Preserved tracebacks when re-raising errors. 2013-03-19 15:42:39 -07:00
humanize Fix 20061: remove out of date comment. 2013-03-16 18:55:24 +01:00
messages Fixed #16319 -- added SuccessMessageMixin to contrib.messages 2013-03-19 21:02:55 -07:00
redirects Merged contrib translations from 1.5 branch 2013-02-26 21:51:06 +01:00
sessions Deprecated transaction.commit/rollback_unless_managed. 2013-03-11 14:48:54 +01:00
sitemaps Fixed #19692 -- Completed deprecation of mimetype in favor of content_type. 2013-01-31 13:54:40 +01:00
sites Fixed #15363 -- Renamed and normalized to `get_queryset` the methods that return a QuerySet. 2013-03-08 10:11:45 -05:00
staticfiles Fixed #19526 2013-02-23 23:05:22 +01:00
syndication Stopped using non-standard __globals__ and __code__ attributes. 2013-03-17 10:44:28 +01:00
webdesign Fixed #18269 -- Applied unicode_literals for Python 3 compatibility. 2012-06-07 18:08:47 +02:00
__init__.py Created django.contrib and moved comments into it 2005-07-14 18:20:03 +00:00