Commit Graph

20 Commits

Author SHA1 Message Date
Tom Christie
c3b7fba918 Exclude read_only=True fields from unique_together validation & add docs. (#4192)
* Exclude read_only=True fields from unique_together validation
* Test to ensure that unique_together validators can be removed
* Do not add uniquness_extra_kwargs when validators are explicitly declared.
* Add docs on validation in complex cases
2016-06-13 13:31:12 +01:00
Tom Christie
9c996d7d2a Clean up existing deprecation warnings. (#4166)
* Add Meta.fields = '__all__' to serializer classes where required.
* Add explicit on_delete=models.CASCADE to ForeignKey fields.
* Use '.remote_field' and '.model' in preference to '.rel' and '.to' when inspecting model fields.
* Use new value_from_object in preference to internal _get_val_from_obj
2016-06-02 14:39:10 +01:00
Xiao Hanyu
19bdfda49a Fix #3844, refine validator for fields with <source=> kwargs
When serializers has fields with something like `source=user.email`, the
uniqueness validator should check `email` field instead of `user`, cause
`user` is a model object.
2016-05-26 10:58:37 +08:00
Stian Jensen
62c000bc12 Use model error_messages when available
In the automatically applied UniqueValidator, use the error message from
error_messages defined in the model instead of the generic default
UniqueValidator message.

This fixes #2878.
2015-09-23 15:20:44 +02:00
José Padilla
7351a3f6ca Sort imports with isort 2015-06-25 16:55:51 -04:00
Aider Ibragimov
aa7ed316d8 Return UniquenessTogetherModel to previous state 2015-02-19 18:09:04 +03:00
Aider Ibragimov
fe8d95f93e Skip validation of NULL field only if it part of unique_together 2015-02-19 18:03:44 +03:00
Aider Ibragimov
3d85473edf Fix UniqueTogetherValidator for NULL values 2015-02-18 21:00:12 +03:00
Tom Christie
8933bc4b14 Merge branch 'validator-pollution' of git://github.com/mhsparks/django-rest-framework into mhsparks-validator-pollution 2014-12-09 16:23:33 +00:00
Tymur Maryokhin
d9930181ee Removed unused imports, pep8 fixes, typo fixes 2014-12-05 00:29:28 +01:00
Mark Hughes
55528addf9 Added test to show potential issue with UniqueValidator being added to the underlying Django model. 2014-12-03 12:30:15 +00:00
Tom Christie
8586290df8 Apply defaults and requiredness to unique_together fields. Closes #2092. 2014-11-19 13:55:10 +00:00
Tom Christie
f387cd89da Uniqueness constraints imply a forced 'required=True'. Refs #1945 2014-11-10 12:21:27 +00:00
Tom Christie
207208fedf Lazy loading of fields and validators. Closes #1963. 2014-10-31 16:38:39 +00:00
Tom Christie
9ebaabd6eb unique_for_date/unique_for_month/unique_for_year 2014-10-28 16:21:49 +00:00
Tom Christie
ae53fdff9c First pass at unique_for_date, unique_for_month, unique_for_year 2014-10-22 13:30:28 +01:00
Tom Christie
5f4cc52ef5 Tweaking 2014-10-09 10:11:44 +01:00
Tom Christie
4798df52df Update release notes 2014-09-29 12:57:05 +01:00
Tom Christie
9805a085fb UniqueTogetherValidator 2014-09-29 11:23:02 +01:00
Tom Christie
43fd5a8730 Uniqueness validation 2014-09-29 09:24:03 +01:00