Commit Graph

508 Commits

Author SHA1 Message Date
Carlton Gibson
c7fb60bcd4 Django 2.0a1 compat (#5503)
* Update remaing `include` calls

Missed as part of #5481 cleanup.

* Provide app_name in include_docs_urls

* Update remaining get_regex_pattern usages

* Allow functools.partial in is_simple_callable check
2017-10-16 11:31:13 +02:00
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
Thierry Bastian
760268ade2 Fixed a deprecation warning (#5058) 2017-09-27 10:51:45 +02:00
John Eskew
607e4edca7 Defer translated string evaluation on validators. (#5452)
* Customize validators to defer error string evaluation.

* Add docstring for `CustomValidatorMessage`
2017-09-26 10:02:20 +02:00
Ryan P Kilby
d740bae95a Update json imports 2017-09-25 09:08:20 +02:00
Carlton Gibson
7d6d043531 Fix DateTimeField TZ handling (#5435)
* Add failing TZ tests for DateTimeField

- tests "current" timezone activation
- tests output for non-UTC timezones

* Update DateTimeField TZ aware/naive test output

* Fix DateTimeField TZ handling

* Add Release Note for BC change
2017-09-20 12:15:15 +02:00
Jeremy Nauta
c0a48622e1 Allow ChoiceField.choices to be set dynamically (#5426)
## Description

The `choices` field for the `ChoiceField` class should be able to be edited after `ChoiceField.__init__` is called.

```
field = ChoiceField(choices=[1,2])
field.choices = [1]  # Should no longer allow `2` as a choice
```

Currently, you must update `choices`, `grouped_choices`, and `choice_strings_to_values` to achieve this. This P/R keeps `grouped_choices` and `choice_strings_to_values` in sync whenever the `choices` are edited.
2017-09-20 11:33:50 +02:00
Igor Tokarev
79be20a7c6 Updated supported values for the NullBooleanField (#5387)
* Updated supported values for the NullBooleanField.
* Added check for unhashable types in NullBooleanField.
2017-09-04 10:11:53 +01:00
Ryan P Kilby
07258ca032 Remove None handling from fields.get_attribute() 2017-08-30 17:42:12 -04:00
kycool
c868378c71 Update fields.py
modify to_choices_dict document
2017-08-18 12:12:01 +08:00
Ryan P Kilby
26ebb88306 Revert 3288 (#5313)
* Add regression test for #2505. Thanks @pySilver!

* Add regression test for #5087

* Revert "Cached the field's root and context property."

This reverts commit 792005806b.
2017-08-07 16:52:09 +01:00
Tom Christie
bf7fcc495b Raise validation error on invalid timezone parsing. 2017-07-10 10:14:31 +01:00
dmmatson
302a9d089e Fixed tests on Windows. Added unicode support to SlugField 2017-06-23 23:11:17 -06:00
Tom Christie
5ba2368ff9 Merge pull request #4987 from halfstrik/master
Added test for DateTimeField validation when server has timezone with…
2017-04-27 17:22:27 +01:00
Tom Christie
33290170e8 Merge pull request #5060 from jpadilla/encode
Update links after moving to encode org
2017-04-07 17:20:51 +01:00
José Padilla
c1f31492ae
Update links after moving to encode org 2017-04-07 10:28:35 -04:00
htmis
4a54d9f474 Update Boolean field to more closely match python library
Python Reference:
distutils.util.strtobool(val)
Convert a string representation of truth to true (1) or false (0).
True values are y, yes, t, true, on and 1; false values are n, no, f, false, off and 0. Raises ValueError if val is anything else.
2017-03-29 20:21:18 -04:00
Sergey Petrunin
b0a0c30bfe Added pytz exception in compat module.
Mock pytz.timezone localize in tests.
Ref: #4986
2017-03-22 00:03:32 -04:00
Sergey Petrunin
e4a1bd140b Update error message.
Ref: #4986
2017-03-20 18:47:25 -04:00
Sergey Petrunin
d4726dab81 Fix bug for not existent or ambiguous datetime during native to aware conversion in timezone with DST.
Ref: #4986
2017-03-18 23:13:26 -04:00
Tibo Beijen
cf5d401a0e Allow required false and default (#4692)
* Default value will now be used when serializing if key or attribute is missing.
2017-03-07 13:19:19 +00:00
Lanrik
5986f95c8d Rearrange code (#4908)
Minor refactor. Move assignment to after `None` check.
2017-02-20 09:48:19 +00:00
李扬
cbad236f6d Add max_length and min_length arguments for ListField (#4877) 2017-02-06 09:36:03 +00:00
Mariusz Felisiak
5c0f9f147c Removed unnecessary utc wrapper. (#4839) 2017-01-23 16:22:32 +00:00
Asif Saifuddin Auvi
026a8d8707 make lint happy with isort --recursive 2017-01-18 22:15:44 +06:00
Asif Saifuddin Auvi
bc3849bd59 added utc compat to fields 2017-01-18 19:31:04 +06:00
Artem Muterko
4dd71d68d2 Remove extra parentheses (#4789) 2017-01-08 16:09:23 +00:00
Artem Muterko
773b68e188 Fix typos in Python files 2017-01-08 15:36:49 +02:00
Nik Nyby
24e082b142 docs: typo fix: it's -> its 2016-12-22 12:44:43 -05:00
Tom Christie
276ed80fd3 Support 'on'/'off' literals with BooleanField. Closes #4624 (#4640) 2016-11-01 11:11:34 +00:00
Ryan P Kilby
eafc9a2393 Fix is_simple_callable with variable args, kwargs (#4622) 2016-10-25 20:47:24 +01:00
Tom Christie
26e51ecd6c When HTML form input is used with JSONField, treat the input as a JSON encoded string, not a JSON primative. (#4565) 2016-10-12 14:04:10 +01:00
Tom Christie
a3802504a0 Error codes (#4550)
Add error codes to `APIException`
2016-10-11 10:25:21 +01:00
Tom Christie
0dec36eb41 Version 3.5 (#4525)
* Start test case

* Added 'requests' test client

* Address typos

* Graceful fallback if requests is not installed.

* Add cookie support

* Tests for auth and CSRF

* Py3 compat

* py3 compat

* py3 compat

* Add get_requests_client

* Added SchemaGenerator.should_include_link

* add settings for html cutoff on related fields

* Router doesn't work if prefix is blank, though project urls.py handles prefix

* Fix Django 1.10 to-many deprecation

* Add django.core.urlresolvers compatibility

* Update django-filter & django-guardian

* Check for empty router prefix; adjust URL accordingly

It's easiest to fix this issue after we have made the regex.  To try
to fix it before would require doing something different for List vs
Detail, which means we'd have to know which type of url we're
constructing before acting accordingly.

* Fix misc django deprecations

* Use TOC extension instead of header

* Fix deprecations for py3k

* Add py3k compatibility to is_simple_callable

* Add is_simple_callable tests

* Drop python 3.2 support (EOL, Dropped by Django)

* schema_renderers= should *set* the renderers, not append to them.

* API client (#4424)

* Fix release notes

* Add note about 'User account is disabled.' vs 'Unable to log in'

* Clean up schema generation (#4527)

* Handle multiple methods on custom action (#4529)

* RequestsClient, CoreAPIClient

* exclude_from_schema

* Added 'get_schema_view()' shortcut

* Added schema descriptions

* Better descriptions for schemas

* Add type annotation to schema generation

* Coerce schema 'pk' in path to actual field name

* Deprecations move into assertion errors

* Use get_schema_view in tests

* Updte CoreJSON media type

* Handle schema structure correctly when path prefixs exist. Closes #4401

* Add PendingDeprecation to Router schema generation.

* Added SCHEMA_COERCE_PATH_PK and SCHEMA_COERCE_METHOD_NAMES

* Renamed and documented 'get_schema_fields' interface.
2016-10-10 13:03:46 +01:00
Tom Christie
4655501d51 Fix regression of RegexField. (#4490)
* Don't deepcopy 'regex' arguments, instead treat as immutable.
2016-09-15 12:44:45 +01:00
Tom Christie
785b206b81 Tweak doctsring. Closes #4404 [ci skip] 2016-08-15 16:21:51 +01:00
Leonid Shvechikov
1d26b398ad Fix comment for SerializerMethodField.bind method (#4389)
It seems that the example was copy&pasted and not updated properly.
2016-08-11 22:15:21 +01:00
Tom Christie
f16e880167 Stricter type validation for CharField. (#4380)
Stricter type validation for CharField
2016-08-10 17:22:19 +01:00
Tom Christie
48f3db36d6 Allow optional max_digits on DecimalField (#4377) 2016-08-10 14:39:26 +01:00
Dmitry Dygalo
e1768bdc16 Fixed various typos (#4366) 2016-08-08 09:32:22 +01:00
Tom Christie
e37619f741 Serializer defaults should not be included in partial updates. (#4346)
Serializer default values should not be included in partial updates
2016-08-02 13:05:12 +01:00
Tom Christie
46a44e52aa Quantize incoming digitals (#4339) 2016-08-01 17:15:41 +01:00
Tom Christie
aa349fe767 Handle non-string input for IP fields (#4338) 2016-08-01 16:14:26 +01:00
kiyoqoko
6338ce80ab Add localize keyword argument to DecimalField (#4233)
Add `localize` keyword argument for DecimalField
2016-07-06 16:07:16 +01:00
Tom Christie
798a971f20 Simplfy TimeField passing through strings (#4197)
* Simplfy TimeField passing through strings
2016-06-14 16:05:00 +01:00
Tom Christie
9406e45b2c Pass through strings as-in with DateTimeField (#4196) 2016-06-14 12:23:39 +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
KhasanovBI
768ae26aa4 Fix None values representation in childs of ListField, DictField. (#4118) 2016-05-16 09:30:23 +01:00
Tom Christie
ebb4070467 Resolve TimeField representation for midnight value. (#4107) 2016-05-10 11:56:36 +01:00
Daniele Varrazzo
88c80fe2e9 Fixed DecimalField arbitrary precision support (#4075) 2016-04-27 17:04:01 +01:00