Commit Graph

49 Commits

Author SHA1 Message Date
Carlton Gibson
c674687782 Remove Django 1.8 & 1.9 compatibility code (#5481)
* Identify code that needs to be pulled out of/removed from compat.py

* Extract modern code from get_names_and_managers in compat.py and remove compat code

* Extract modern code from is_authenticated() in compat.py and remove.

* Extract modern code from is_anonymous() in compat.py and remove

* Extract modern code from get_related_model() from compat.py and remove

* Extract modern code from value_from_object() in compat.py and remove

* Update postgres compat

JSONField now always available.

* Remove DecimalValidator compat

* Remove get_remote_field compat

* Remove template_render compat

Plus isort.

* Remove set_many compat

* Remove include compat
2017-10-05 20:41:38 +02:00
Dryice Liu
04adfb9c94 make sure max_length is in FileField kwargs 2017-05-28 04:14:56 +08:00
German Ilyin
5246a5a44e Fix a typo in a comment 2017-05-04 10:13:58 +06:00
Dave Allan
7a0bd1c4d1 Use text area for JSON fields and indent JSON 2017-04-26 14:10:47 -04:00
Ekluv
56fe0e4b3f fix unique=True validation for ChoiceField 2017-03-28 00:38:21 +05:30
Tom Christie
8d0a91b002 Fix 3674 (#4571)
Handle ModelSerializer case for relationships to models with custom pk.
2016-10-13 12:43:43 +01:00
Dmitry Dygalo
e1768bdc16 Fixed various typos (#4366) 2016-08-08 09:32:22 +01:00
Sassan Haradji
f0f61aa077 use verbose_name instead of object_name in field_mapping (#4299)
* use verbose_name instead of object_name in error messages
2016-07-26 15:12:51 +01:00
Kevin Brown
a772326112 Merged two DecimalValidator tests together
These two tests were previously added in
7d79cf35b7
but we have now discovered that there are not actually two separate
cases, there was just a  bug in the code that made it look that way.

This also removes a redundant check to see if `DecimalValidator` was
defined.
2016-01-04 10:22:17 -05:00
Kevin Brown
87605e1e39 Don't filter out the DecimalValidator if it is not supported
Previously, all validators set on a DecimalField in Django would be
stripped when converted to a Django REST framework field. This was
because any validator that was an instance of `DecimalValidator` would
be removed, and when `DecimalValidator` wasn't supported (so it was
`None`), all validators would be removed.

This fixes the issue by only removing the `DecimalValidator` instances
if the `DecimalValidator` is supported.
2015-12-24 14:10:48 -05:00
José Padilla
41d1e42e9c Add compat util for DecimalValidator 2015-10-29 06:42:16 -04:00
José Padilla
d64bfef56a Map all supported FilePathField options 2015-10-23 10:08:29 -04:00
likeon
322bda8159 Added support for the to_field on ForeignKey fields 2015-10-21 15:33:18 +03:00
José Padilla
a1dad503cf Map TextField max_length to CharField 2015-10-16 07:17:33 -04:00
Tom Christie
02e1f69d2b Django 1.9 support 2015-09-28 11:44:07 +01:00
Tom Christie
ca8313aeac Merge branch 'master' into version-3.3
Conflicts:
	docs/topics/release-notes.md
2015-09-28 10:57:14 +01: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
Carlton Gibson
8ea1606abf Remove Django 1.5 clean_manytomany_helptext fallback 2015-09-21 20:16:52 +02:00
Tom Christie
afd2a8f8f0 Adjust ModelField.null mappings now that Django-25320 is resolved 2015-09-03 10:12:52 +01:00
Tom Christie
78632849cf Comment against model_field.null 1.98 behavior 2015-08-28 13:29:57 +01:00
Tom Christie
8db6367188 Deal with 1.9's differing null behavior on reverse relationships and m2m 2015-08-28 12:08:32 +01:00
Tom Christie
b6c4d8c25a Resolve duplicate error for IPAddressField. Closes #3250. 2015-08-20 12:38:48 +01:00
Tom Christie
27ac5a3680 Support grouped choices 2015-08-06 11:43:03 +01:00
Tom Christie
650866cc43 Blank relational fields map to required=False serializer fields. Closes #3210. 2015-08-03 09:48:03 +01:00
Tom Christie
e68d737825 Respect blank on many to many, and set allow_empty=False if it is not present. Closes #2804. 2015-07-30 17:03:08 +01:00
José Padilla
7351a3f6ca Sort imports with isort 2015-06-25 16:55:51 -04:00
José Padilla
83c9136c90 Cleanup import following PEP 8 style guide 2015-06-25 16:10:17 -04:00
Tom Christie
8d4c96ecd6 Merge pull request #3012 from jannon/fix-allow-blank-mapping
only include 'allow_blank' on supported fields
2015-06-24 11:01:10 +01:00
Jannon Frank
2c415d7e03 models.TextFields get mapped to serializers.CharField too 2015-06-16 14:05:19 -07:00
Jannon Frank
b0752217ae only include 'allow_blank' on CharField 2015-06-05 02:21:13 -07:00
Udi Oron
b95ef25cbb Wrong error message on bad field lookup 2015-03-26 20:13:35 +02:00
Tom Christie
889a07f556 Support assignment in ClassLookupDict 2015-01-23 15:32:21 +00:00
Tom Christie
8cf3744971 Ensure no invalid min_length/min_value/max_value arguments. Closes #2369. 2015-01-05 10:52:18 +00:00
Tom Christie
ef2eff2aba Only pass max_length for CharField. Closes #2317. 2014-12-28 11:07:38 +00:00
Remi Paulmier
6c5ff71278 fix the way to use textarea rather than input with models.TextField 2014-12-22 18:05:07 +01:00
Tom Christie
7d70e56ce3 Copy model field validators, don't reuse the same list. 2014-12-09 16:25:10 +00:00
José Padilla
afe7ed9333 Add allow_blank for ChoiceField #2184
This makes a ChoiceField optional in HTML if
model field has `blank=True` set.
2014-12-09 09:25:06 -04:00
Tom Christie
4e03518438 required=False for nullable relationships 2014-11-13 23:30:42 +00:00
Tom Christie
ea98de9b88 Model fields with .blank or .null now map to required=False. Closes #2017. Closes #2021. 2014-11-13 19:28:57 +00:00
Tom Christie
e399140031 Minor tweaks 2014-11-07 10:51:08 +00:00
Tom Christie
14ae52a24e More gradual deprecation 2014-10-08 16:09:37 +01:00
Tom Christie
6bfed6f852 Enforce uniqueness validation for relational fields 2014-10-07 17:04:53 +01:00
Tom Christie
df7b6fcf58 First pass on incorperating the form rendering into the browsable API 2014-10-02 16:24:24 +01:00
Tom Christie
c171fa21ac First pass at HTML form rendering 2014-10-01 19:44:46 +01:00
Tom Christie
43fd5a8730 Uniqueness validation 2014-09-29 09:24:03 +01:00
Tom Christie
f4b1dcb167 OPTIONS support 2014-09-24 14:09:49 +01:00
Tom Christie
0404f09a7e NullBooleanField 2014-09-23 14:30:17 +01:00
Tom Christie
f22d0afc3d Tests for field choices 2014-09-23 14:15:00 +01:00
Tom Christie
5b7e4af0d6 get_base_field() refactor 2014-09-18 11:20:56 +01:00