Commit Graph

488 Commits

Author SHA1 Message Date
Loic Bistuer 8847a0c601 Fixed #16192 -- Made unique error messages in ModelForm customizable.
Overriding the error messages now works for both unique fields, unique_together
and unique_for_date.

This patch changed the overriding logic to allow customizing NON_FIELD_ERRORS
since previously only fields' errors were customizable.

Refs #20199.

Thanks leahculver for the suggestion.
2014-02-08 04:59:09 -05:00
Russell Keith-Magee d818e0c9b2 Fixed #16905 -- Added extensible checks (nee validation) framework
This is the result of Christopher Medrela's 2013 Summer of Code project.

Thanks also to Preston Holmes, Tim Graham, Anssi Kääriäinen, Florian
Apolloner, and Alex Gaynor for review notes along the way.

Also: Fixes #8579, fixes #3055, fixes #19844.
2014-01-20 10:45:21 +08:00
Claude Paroz 0179852d7f Fixed #8898 -- Obsoleted SplitDateTimeWidget usage with DateTimeField
Thanks Tim Graham for the review.
2014-01-11 15:50:34 +01:00
Claude Paroz 18374c1d8c Fixed #21752 -- Prevented custom widget step attribute to be overwritten
Thanks orcein at gmail.com for the report.
2014-01-11 14:08:04 +01:00
Marc Sibson 81bb8d1220 Fixed docstring typo in django/forms/forms.py. 2014-01-10 08:33:30 -05:00
Loic Bistuer 2fd7fc134c Refs #17413 -- Added isinstance backward compatibility on ErrorList. 2013-12-18 08:59:53 -05:00
Artur Barseghyan fe1389e911 Removed duplicated `TimeField` in __all__. 2013-12-16 17:52:37 -05:00
Loic Bistuer 3ce9829b61 Fixed #17413 -- Serialization of form errors along with all metadata. 2013-12-16 16:33:28 -05:00
Loic Bistuer 6685713869 Fixed E127 pep8 warnings. 2013-12-14 11:59:15 -05:00
Loic Bistuer a2814846ca Fixed E124 pep8 warnings. 2013-12-10 15:12:48 -05:00
Claude Paroz 8a9c8bb907 Fixed #21568 -- Added missing ModelMultipleChoiceField to_python method
Thanks dibrovsd at gmail.com for the report and Simon Charette
for the review.
2013-12-07 10:14:22 +01:00
Loic Bistuer f563c339ca Fixed #20867 -- Added the Form.add_error() method.
Refs #20199 #16986.

Thanks @akaariai, @bmispelon, @mjtamlyn, @timgraham for the reviews.
2013-11-30 01:00:53 +07:00
Christopher Medrela 7477a4ffde Fixed E125 pep8 warnings 2013-11-28 08:50:11 -05:00
Loic Bistuer 1c7a83ee8e Fixed #21489 -- Make formsets directly importable from django.forms. 2013-11-25 19:16:19 -05:00
Claude Paroz fafb6cf049 Fixed #21472 -- Fixed inline formsets display when parent pk is 0
Thanks agale031176@gmail.com for the report.
2013-11-20 21:36:20 +01:00
Claude Paroz a0f3eeccf3 Fixed #21397 -- Re-added flexibility to TypedChoiceField coercion
Thanks Elec for the report and Simon Charette for the review.
2013-11-18 18:24:56 +01:00
Anssi Kääriäinen 326539f6a4 Fixed a regression caused by fix for #21428
On Python 3 sorting Fields mixed with GenericForeignKeys doesn't work
as GenericForeignKey isn't a subclass of django.db.models.fields.Field.

Refs #21428.
2013-11-16 20:54:36 +02:00
Anssi Kääriäinen 0e079e4331 Fixed #21428 -- editable GenericRelation regression
The GenericRelation refactoring removed GenericRelations from
model._meta.many_to_many. This had the side effect of disallowing
editable GenericRelations in ModelForms. Editable GenericRelations
aren't officially supported, but if we don't fix this we don't offer any
upgrade path for those who used the ability to set editable=True
in GenericRelation subclass.

Thanks to Trac alias joshcartme for the report and stephencmd and Loic
for working on this issue.
2013-11-16 20:07:35 +02:00
Baptiste Mispelon 5fda9c9810 Fixed #21423 -- Fixed typo in widgets.py. 2013-11-11 18:03:01 +01:00
Claude Paroz bc21e9c0d9 Fixed #13970 -- Made SelectDateWidget use the standard widget is_required attribute
Thanks mitar for the report and Tim Graham for the review.
2013-11-08 16:58:17 +01:00
Alex Gaynor c347f78cc1 Fixed all E226 violations 2013-11-03 10:08:55 -08:00
Alex Gaynor 7288e1b02b Merge pull request #1852 from jasonamyers/cleanup/PEP8
Cleanup/pep8 tests
2013-11-03 09:51:49 -08:00
Alex Gaynor 91078f5669 Merge pull request #1861 from milmazz/E251
Fixed flake8 E251 violations
2013-11-03 09:42:31 -08:00
Jason Myers 4f151da1e5 Merging in master
Signed-off-by: Jason Myers <jason@jasonamyers.com>
2013-11-03 07:19:25 -06:00
Jim Bailey 539e3693d4 Fixed #20849 -- ModelForms do not work well with prefetch_related.
model_to_dict() (used when rendering forms) queries the database
to get the list of primary keys for ManyToMany fields. This is
unnecessary if the field queryset has been prefetched, all the
keys are already in memory and can be obtained with a simple
iteration.
2013-11-03 12:27:54 +02:00
Milton Mazzarri cbc7cbbc5b Fixed flake8 E251 violations 2013-11-03 03:22:11 -06:00
Jason Myers c3791463a5 Fixing E302 Errors
Signed-off-by: Jason Myers <jason@jasonamyers.com>
2013-11-02 23:48:47 -05:00
Alex Gaynor fe995e6cbd Fixed the remaining E302 violations int eh django package 2013-11-02 17:37:15 -07:00
Alex Gaynor 7548aa8ffd More attacking E302 violators 2013-11-02 13:12:09 -07:00
Boryslav Larin e737c009b8 Fixed flake8 E241 2013-11-02 21:45:40 +02:00
Alex Gaynor ee48f4af99 Merge pull request #1848 from rayashmanjr/master
Correct flake8 violation E261
2013-11-02 12:34:34 -07:00
Ray Ashman Jr dcfc8fa972 Correct flake8 violation E261 2013-11-02 15:27:47 -04:00
Tim Graham 36ded01527 Fixed #21302 -- Fixed unused imports and import *. 2013-11-02 15:24:56 -04:00
Anssi Kääriäinen efb0100ee6 Fixed #14877 -- repeated deletion using formsets
When a formset contained deletion for an existing instance, and the
instance was already deleted, django threw an exception. A common cause for
this was resubmit of the formset.

Original patch by Trac alias olau.

In addition this commit cleaned some code in _construct_form(). This
was needed as the primary key value the user submitted wasn't converted
correctly to python value in case the primary key field was also a
related field.
2013-10-30 22:40:15 +02:00
Alex Gaynor b35ff0d920 Fixed all the E203 violations 2013-10-26 18:27:42 -07:00
Alex Gaynor f2d8027c9a Fixed up some more flake8 violations (this particular violation still has many occurrences in the tests/ dir so it can't be removed from setup.cfg yet) 2013-10-26 10:50:40 -07:00
Alex Gaynor 9bf5610890 Start attacking E231 violations 2013-10-24 10:30:03 -07:00
Alasdair Nicol c3aa2948c6 Fixed #21298 -- Fixed E301 pep8 warnings 2013-10-23 13:45:03 +01:00
Tim Graham ae48d77ef8 Fixed E225 pep8 warnings. 2013-10-23 06:09:29 -04:00
Tim Graham 8e2029f8dd Removed import * in tests.
Thanks to flake8 path/to/file.py | awk -F ' ' '{ print $5 }' | sort | uniq
2013-10-22 08:32:01 -04:00
Alasdair Nicol b289fcf1bf Fixed #21288 -- Fixed E126 pep8 warnings 2013-10-21 08:31:30 -04:00
Alasdair Nicol a800036981 Fixed #21287 -- Fixed E123 pep8 warnings 2013-10-18 10:07:39 +01:00
Alasdair Nicol bab9123daa Fixed #21268 -- Fixed E303 pep8 warnings 2013-10-18 01:46:24 +01:00
Alasdair Nicol eb214452c3 Fixed #21270 -- Fixed E701 pep8 warnings 2013-10-17 12:12:40 +01:00
Loic Bistuer b16dd1fe01 Fixed #8620 -- Updated the Form metaclass to support excluding fields by shadowing them. 2013-10-14 22:42:33 +07:00
Loic Bistuer ac5ec7b8bc Fixed #19617 -- Refactored Form metaclasses to support more inheritance scenarios.
Thanks apollo13, funkybob and mjtamlyn for the reviews.
2013-10-14 21:59:30 +07:00
Claude Paroz 00a73c1c69 Fixed #21173 -- Stopped fixing format for date-based widgets at init time
Thanks Marc Tamlyn for the review.
2013-10-12 18:31:19 +02:00
Tim Graham b67ab75e82 Fixed assorted flake8 errors. 2013-10-11 07:25:14 -04:00
Tim Graham cec11a3336 Used "is" for comparisons with None. 2013-10-10 09:35:56 -04:00
Christopher Babiak a834bc84d8 Fixed #20931 -- Fixed select widgets nested choice rendering
ChoiceFieldRenderer was not rendering nested choices. Added recursion
to ChoiceFieldRenderer to take nested choices and render them as
<ul>'s.
2013-09-28 17:25:32 -07:00