1
0
mirror of https://github.com/django/django.git synced 2025-07-07 11:19:12 +00:00

7220 Commits

Author SHA1 Message Date
Honza Král
ae581816be [soc2009/model-validation] Added code param to ValidationError and use it to override validator's messages
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@11035 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-18 00:31:57 +00:00
Honza Král
d707d37048 [soc2009/model-validation] Changed EmailField to use validators
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@11034 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-18 00:31:37 +00:00
Honza Král
3772800752 [soc2009/model-validation] Do not run simple validators on empty values
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@11033 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-18 00:31:18 +00:00
Honza Král
eea2bfd941 [soc2009/model-validation] Added a useless import to maintain ackwards compatibility
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10950 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-08 00:56:16 +00:00
Honza Král
9dee3b26e5 [soc2009/model-validation] Added tests for ComplexValidators
Also the tests for validators can now verify other exceptions and not
just ValidationError

git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10949 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-08 00:56:01 +00:00
Honza Král
8a5e9f6939 [soc2009/model-validation] Corrected a typo in format string
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10948 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-08 00:55:45 +00:00
Honza Král
c43edf6d76 [soc2009/model-validation] Moved execution of validators to separate method
This method (run_validators) is being run after the validate() method
finishes and doesn't produce any errors. Errors from individual
validators are aggregated and then raised together in one
ValidationError.

git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10947 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-08 00:55:27 +00:00
Honza Král
6d840d9b05 [soc2009/model-validation] Introduced ComplexValidator and changed the validator handling logic.
Field.validate() now calls all validators except for ComplexValidator
instances which are then run in the form's clean() method.

git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10946 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-08 00:55:07 +00:00
Honza Král
ca9cecb702 [soc2009/model-validation] Have model fields use EMPTY_VALUES from validators
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10945 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-08 00:54:45 +00:00
Honza Král
3e625f2667 [soc2009/model-validation] Merged to trunk at r10941
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10944 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-08 00:54:28 +00:00
Honza Král
7b14625d0d [soc2009/model-valition] Merged to trunk at r10914
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10916 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-03 14:03:10 +00:00
Honza Král
85e0c469aa [soc2009/model-validation] added validate_email validator
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10910 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-03 02:39:02 +00:00
Honza Král
ef84cf85ba [soc2009/model-validation] Added code for calling validators on form fields
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10909 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-03 02:38:39 +00:00
Honza Král
a9efb44c01 [soc2009/model-validation] FileFields migrated
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10908 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-03 02:38:23 +00:00
Honza Král
92934650f6 [soc2009/model-validation] More fields migrated to split to_python/validate
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10907 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-03 02:38:06 +00:00
Honza Král
7506471585 [soc2009/model-validation] rest of the form fields split
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10906 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-03 02:37:51 +00:00
Honza Král
eed2445d02 [soc2009/model-validation] Date based fields
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10905 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-03 02:37:36 +00:00
Honza Král
795cd55ba2 [soc2009/model-validation] DecimalField done
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10903 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-03 02:37:20 +00:00
Honza Král
08652c8501 [soc2009/model-validation] FloatField is IntegerField with a twist
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10902 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-03 02:37:04 +00:00
Honza Král
e33029cca3 [soc2009/model-validation] IntegerField migrated to split to_python/validate
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10901 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-03 02:36:49 +00:00
Honza Král
45af711718 [soc2009/model-validation] Spit FormField.clean() to to_python() and validate()
Also moved EMPTY_VALUES to validators module and implemented the change
on first Field (CharField)

git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10900 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-03 02:36:33 +00:00
Honza Král
b963651223 [soc2009/model-validation] added validators param to FormField
This is still not used anywhere

git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10899 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-03 02:36:16 +00:00
Honza Král
14f9493380 [soc2009/model-validation] Added first validator with tests
No usefull error message yet, validator isn't used anywhere, just a
mockup basically

git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10898 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-03 02:35:59 +00:00
Honza Král
2f8f8bf531 [soc2009/model-validation] Tests now pass for validate_unique
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10886 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-02 00:38:13 +00:00
Honza Král
41bf859b67 [soc2009/model-validation] Make GetUniqueCheckTests proper testCase since it doesn't need DB
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10885 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-02 00:37:54 +00:00
Honza Král
855423542c [soc2009/model-validation] remove validate_unique from ModelForm
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10884 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-02 00:37:38 +00:00
Honza Král
ea52757c10 [soc2009/model-validation] Tests for Model._get_unique_checks
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10883 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-02 00:37:23 +00:00
Honza Král
d484d021f2 [soc2009/model-validation] just enough code editted so that validation tests pass
And we may begin our testing of the added functionality

git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10882 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-02 00:37:00 +00:00
Honza Král
c51798f4fa [soc2009/model-validation] Moved validate_unique to Model
It is broken currently since the code hasn't been touched yet

git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10881 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-02 00:36:39 +00:00
Honza Král
4449ff33a0 [soc2009/model-validation] Added tests using model inheritance
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10880 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-01 20:10:32 +00:00
Honza Král
eae2b9c149 [soc2009/model-validation] Added simple tests for ForeignKey validation.
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10879 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-01 15:42:29 +00:00
Honza Král
afcb3c8872 [soc2009/model-validation] moved validation tests to tests.py out of models.py
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10878 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-01 15:42:13 +00:00
Honza Král
3ca1199da8 [soc2009/model-validation] Added validation for ForeignKey
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10877 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-01 15:41:56 +00:00
Honza Král
32916adca8 [soc2009/model-validation] Dont't validate already failed fields
This removes the duplicate messages we have been seeing

git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10876 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-01 15:41:41 +00:00
Honza Král
e573fb41e9 [soc2009/model-validation] Corrected test for #10750
We don't need invalid formset (excluding required fields) in order to
test whether .save() is being called if commit=False

git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10875 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-01 15:41:15 +00:00
Honza Král
0467891c41 [soc2009/model-validation] Updated tests for auth.forms.
The errors are still duplicated (one from model, one from form), we will
remove that duplication later on.

git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10874 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-01 15:40:56 +00:00
Honza Král
a6a8ae6408 [soc2009/model-validation] UserCreationForm made easier
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10873 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-01 15:40:35 +00:00
Honza Král
a094bda10a [soc2009/model-validation] Added test for field.blank
We still have to decide what to do with fields that have duplicate errors:
 - required from form
 - blank on model
This change resulted in some tests being rendered as invalid. For
example excluding a required field or doing save_as_new on InlineFormset
with non-existing instance.

git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10872 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-01 15:40:18 +00:00
Honza Král
4d73902653 [soc2009/model-validation] Split save_instance into make and save_made
had to add a magical attribute __adding on ModelForm to indicate whether
we are editting or adding a model. This will be later passed into the
model's .clean() method since it is necessary for correctly validating
uniques (see it's current use) and can also be used to define
force_insert or force_update params to model.save()

Also beginning with this commit, .instance attribute is present on ModelForm
and should be used to do any post-processing since manipulation of the
cleaned_data will not work

git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10871 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-01 15:39:46 +00:00
Honza Král
2f0e6d5595 [soc2009/model-validation] Save object before validating it's edit inlines when creating an object
in the admin interface

git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10870 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-01 15:39:21 +00:00
Honza Král
6152164303 [soc2009/model-validation] Added clean() and validate() methods to Model.
This also called for ValidationError to also accept dicts as message.

git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10869 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-01 15:38:58 +00:00
Honza Král
b59bfbd128 [soc2009/model-validation] Implemented some basic validation on model Fields including basic tests.
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10868 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-01 15:38:34 +00:00
Honza Král
55e23d5efa [soc2009/model-validation] Moved ValidationError to django.core.exceptions and removed ErrorList from within the Error
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10867 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-01 15:38:11 +00:00
Honza Král
a2b2152635 [soc2009/model-validation] Added myself to AUTHORS
first checkin to verify my setup

git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10866 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-06-01 15:37:41 +00:00
Jacob Kaplan-Moss
9c93f31d40 Created "model-validation" branch for Honza Král's SoC project.
git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10853 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-27 18:46:02 +00:00
Karen Tracey
7638651cc3 Fixed #11204 -- Corrected typo in the pluralize doc. Thanks martin and SmileyChris.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10849 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-27 16:26:56 +00:00
Karen Tracey
9b19fd7a76 Fixed #11209 -- Added a note to doc on connection.queries that the logged sql may not inlude parameter quoting.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10847 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-27 16:20:11 +00:00
Karen Tracey
bdf33b37da Fixed #11215 -- Replaced erroneous catch with except in testing doc.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10845 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-27 16:03:51 +00:00
Karen Tracey
5dc30c9fd2 Fixed #11205 -- Made the links to the str method description look the same as the links to the unicode method description in the tutorial part 1. Having one be fully qualified while the other was not was odd-looking.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10843 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-26 16:46:56 +00:00
Karen Tracey
5e20adcdf6 Fixed #11202 -- Removed mod_python information from FAQ, as it is no longer the recommended deployment option, in favor of more general pointers to the docs and wiki where deployment is discussed in depth.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@10841 bcc190cf-cafb-0310-a4f2-bffc1f526a37
2009-05-26 16:27:12 +00:00