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
321133242f
Unsaved file objects may not have an associated URL.
2015-06-24 14:24:19 +01:00
Tom Christie
39ece9bee0
Support allow_blank=False with trim_whitespace=True.
2015-06-24 13:32:54 +01:00
Anton Chaporgin
47acec0f9d
Made exception message more verbose
...
This exception helps you to upgrade from 2 -> 3 and since a lot of fields may be in 2 using serializers.Field as parent class, this message should contain at least name of upgraded field to help user to grep and fix the codebase faster.
2015-06-24 11:59:49 +03:00
Tom Christie
a3d6601e09
Merge pull request #3008 from linovia/feature/ipaddress-fix
...
`IPAddressField` improvements
2015-06-04 14:54:50 +01:00
Tom Christie
e8cc948f6b
Merge pull request #2695 from delinhabit/refactor-decimalfield
...
[enhancement] Refactored DecimalField to allow easier subclassing
2015-06-04 14:26:28 +01:00
Xavier Ordoquy
dee5fb5647
Merge remote-tracking branch 'reference/master' into feature/ipaddress-fix
...
Conflicts:
docs/api-guide/fields.md
2015-06-04 14:21:33 +01:00
Xavier Ordoquy
0c66c7cfa6
Merge pull request #3000 from linovia/ovangle/uuid_format2
...
Add 'format' argument to UUIDField
2015-06-03 12:32:23 +01:00
Xavier Ordoquy
f8eacc5bc0
Merge pull request #2993 from linovia/bug/2894
...
MultipleChoiceField empties incorrectly on a partial update using multipart/form-data (#2894 )
2015-06-01 17:48:20 +01:00
Nicolas Delaby
f701ecceb7
Add DurationField
2015-06-01 18:20:53 +02:00
Xavier Ordoquy
5c90bf9cc0
Fix for #2894 thanks to @carljm
2015-06-01 16:13:35 +01:00
Michał Hernas
e8c226c2db
Fixed lint problems
2015-05-18 16:55:40 +02:00
Michał Hernas
069ea31cfb
Added test ensuring DecimalField accepts 2E+2
as 200 and validates
...
decimal place correctly.
2015-05-18 16:42:24 +02:00
David Sanders
b7edd46313
Use simpler dict.get() rather than try/except
2015-05-16 01:01:27 +10:00
David Sanders
8e84a9f6d0
Allow invalid outputs to pass through to_representation() for ChoiceField & MultipleChoiceField
2015-05-15 18:59:10 +10:00
Ryan Allen
cbea03c85b
DateField to_representation can handle str and empty values. Fixes #2656 , #2687 .
2015-04-23 19:31:46 -05:00
Ryan Allen
32acc4a72b
Set IntegerField class variable for compiled decimal regex, comment for purpose
2015-04-21 10:52:52 -04:00
Ryan Allen
1f10a39d31
Match IntegerField validation with Django's, preventing decimal values being stored as ints, fixes #2835 .
...
Match IntegerField validation with Django IntegerField, prevents decimal values being stored as ints, fixes #2835
On branch master
2015-04-20 11:03:05 -04:00
Thomas Stephenson
236b731072
Add 'format' argument to UUIDField
...
To allow serializations to control the representation format of a
UUID value
2015-04-12 22:07:25 +10:00
Andrea Grandi
d6effbf779
Remove unpack_ipv4 parameter
2015-04-02 19:40:17 +01:00
Michael Blatherwick
56ec7b152e
Fixed docstring typo
2015-03-27 18:00:19 +00:00
Andrea Grandi
466575bee6
Lowercase the input
2015-03-26 18:14:53 +00:00
Ion Scerbatiuc
022c4d540b
Refactored DecimalField to allow easier subclassing
2015-03-14 07:16:17 -07:00
Aider Ibragimov
c44376c613
remove unnecessary check
2015-03-04 14:17:58 +03:00
Tymur Maryokhin
391b0ae21b
Call default.set_context() only on create. Refs #2619 .
2015-03-03 17:02:12 +01:00
Aider Ibragimov
e5d95e319e
fix FilePathField kwargs for django < 1.5
2015-03-03 16:58:04 +03:00
Aider Ibragimov
04cc1964bd
remove dict compehension
2015-03-03 16:45:20 +03:00
Aider Ibragimov
5f8338e276
Merge branch 'master' of https://github.com/tomchristie/django-rest-framework into feature/filepathfield
2015-03-03 14:34:18 +03:00
Aider Ibragimov
c20a0250df
add FilePathField, update docs
2015-03-03 14:34:06 +03:00
Aider Ibragimov
de72022f80
Merge branch 'master' of https://github.com/Ins1ne/django-rest-framework into feature/ipaddress
2015-02-28 14:29:27 +03:00
Aider Ibragimov
4d5eee04a0
add IPAddressField, update docs
2015-02-28 10:11:38 +03:00
Kevin Wood
78e8b1b010
Updated CreateOnlyDefault to call set_context on its default (if callable)
2015-02-27 22:14:15 -08:00
Janusz Harkot
9098856d46
fix DictKey initial value
2015-02-27 19:46:36 +01:00
Tom Christie
cda74b5997
Merge pull request #2608 from ezheidtmann/dont-swallow-errors-in-callable-sources
...
Dont swallow errors in callable sources
2015-02-27 09:13:01 +00:00
Evan Heidtmann
e6b06c34c1
Add explanation for this exception mutation
2015-02-26 09:20:17 -08:00
Evan Heidtmann
bdb73d5588
Avoid swallowing exceptions thrown in callable attributes
2015-02-26 09:05:46 -08:00
Rense VanderHoek
91416632a8
DecimalField fix
...
max_value and min_value are not in kwargs
2015-02-21 12:31:37 +01:00
Rense VanderHoek
9cb547b85f
Validator-fix, added min/max fields to test_metadata
2015-02-20 17:34:49 +01:00
Rense VanderHoek
c8609ba652
Set field length/values as actual attributes.
...
The SimpleMetadata class in metadata.py tries to getattr() attributes
on a field. For this to work, max_length and min_length have to be
actually set as an attribute.
Did the same for min_value and max_value and added those two to
SimpleMetadata.get_field_info
2015-02-20 16:31:12 +01:00
Tom Christie
c3425accde
Fix incorrect HTML parsing for DictField
2015-02-11 14:19:07 +00:00
Tom Christie
dec3493d7c
Minor cleanup
2015-02-06 14:43:43 +00:00
José Padilla
7f801b9a01
Add trim_whitespace to CharField #2517
...
If set to `True` then leading and trailing
whitespace is trimmed. Defaults to `True`.
2015-02-06 01:09:19 -04:00
Tom Christie
4ee4b4f2dc
Merge master
2015-01-30 14:00:25 +00:00
Tom Christie
35f6a82462
Added DictField and support for HStoreField.
2015-01-23 16:27:23 +00:00
Tom Christie
e8db1834d3
Added UUIDField.
2015-01-23 15:24:06 +00:00
Tom Christie
11efde8905
Merge pull request #2373 from jakul/document-translations-3.1
...
Document how to translate DRF error messages (version 3.1)
2015-01-09 11:57:02 +00:00
Craig Blaszczyk
58ec7669ae
swap backticks for double quotes
2015-01-07 18:22:30 +00:00
Craig Blaszczyk
91e316f781
prefer single quotes in source and double quotes in user visible strings; add some missing full stops to user visible strings
2015-01-07 12:46:23 +00:00
Craig Blaszczyk
9a4267049b
use double quotes in user messages
2015-01-07 12:33:37 +00:00
Craig Blaszczyk
4c32083b8b
use double quotes for user visible strings; end user visible strings in full stops; add some missing translation tags
2015-01-07 12:01:11 +00:00
Tom Christie
b6ca7248eb
required=False allows omission of value for output. Closes #2342
2015-01-05 14:32:12 +00:00
Craig Blaszczyk
a90ba2bc11
update error messages for language and consistency
2015-01-02 11:08:31 +00:00
Tom Christie
77e3021fea
Better behaviour with null and '' for blank HTML fields.
2014-12-20 16:26:51 +00:00
Tom Christie
87ac64e41b
Fixes for behavior with empty HTML fields.
2014-12-18 10:36:52 +00:00
Tom Christie
3fff5cb6e0
Fix empty HTML values when a default is provided.
2014-12-17 15:13:48 +00:00
Tom Christie
af53e34dd5
Merge pull request #2279 from tomchristie/fix-serializer-repr-unicode-bug
...
Use unicode internally everywhere for 'repr'.
2014-12-15 12:04:46 +00:00
Tom Christie
72e08a3e8b
Use unicode internally everywhere for 'repr'
2014-12-15 11:55:17 +00:00
Tom Christie
488b13e7b8
Better messaging for 'Field.to_representation'. Closes #2271 .
2014-12-15 09:29:54 +00:00
Tom Christie
aa571abb20
Better errors when serializer has incorrectly named field.
2014-12-13 14:58:04 +00:00
Peter Schmidt
fa1ef33bfc
Update CharField default min_length message.
2014-12-12 11:16:29 +11:00
Tom Christie
81d0b748b4
Improve field lookup behavior for dicts/mappings. Closes #2244 . Closes #2243 .
2014-12-10 09:16:01 +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
eee02a47d9
Added ListSerializer.validate(). Closes #2168 .
2014-12-08 14:56:45 +00:00
Tymur Maryokhin
d54c67d79d
Removed custom StringIO, force_text, smart_text compat
2014-12-04 03:11:42 +01:00
Tom Christie
d2d7e1dfde
Drop Field.validate
2014-11-27 16:41:53 +00:00
Tom Christie
8579222cbd
Fix for nested attribute lookups where one is a callable
2014-11-27 15:14:11 +00:00
Tom Christie
1ffe4857ec
Support callable attributes in dotted source. Closes #2142 .
2014-11-27 08:10:52 +00:00
Tom Christie
06fd63dade
Don't use default_empty_html value for partial updates. Closes #2118 .
2014-11-25 11:14:28 +00:00
Tom Christie
6794b3380a
Fixes for defaulting empty HTML fields to '', None, or empty.
2014-11-20 12:15:33 +00:00
Tom Christie
e49d22dbda
Allow blank choices to render. Closes #2071 .
2014-11-19 09:31:26 +00:00
Tom Christie
0f508c5821
Docs for advanced default argument usage. Closes #1945
2014-11-17 18:36:32 +00:00
Tom Christie
62ce653c61
Update fields.py
2014-11-10 14:44:26 +00:00
Tom Christie
eafb7e1e24
ModelField fix. Closes #2018 .
2014-11-07 11:44:16 +00:00
Tymur Maryokhin
ea76dc18b6
Fixed base_url duplication in FileField.use_url
...
Django already joins base_url when constructing FileField.url
2014-11-06 18:20:55 +01:00
Tom Christie
4e001dbb7a
Drop usage of SortedDict. Closes #2027 .
2014-11-06 12:00:30 +00:00
Tom Christie
ed541864e6
Support for bulk create. Closes #1965 .
2014-11-06 10:34:59 +00:00
Tom Christie
73daf40715
ModelField should support max_length. Closes #2018 .
2014-11-05 15:51:45 +00:00
Tom Christie
0a5d088287
Fix failing copy of fields when RegexValidator is used. Closes #1954 .
2014-11-05 10:48:30 +00:00
Tom Christie
26b6180f50
Support None if initial part of dotted lookup returns None. Closes #1223 .
2014-11-05 10:28:34 +00:00
Tom Christie
207208fedf
Lazy loading of fields and validators. Closes #1963 .
2014-10-31 16:38:39 +00:00
Tom Christie
bacf8cfa9d
Guard against malicious string inputs for numbers. Closes #1903 .
2014-10-31 15:41:00 +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
05cbec9dd7
Use serializers.ValidationError
2014-10-17 13:23:14 +01:00
Tom Christie
32fd82ba0d
get_attribute method on fields
2014-10-16 20:47:57 +01:00
Tom Christie
b4f3379c70
Support fields that reference a simple callable
2014-10-15 15:13:28 +01:00
Tom Christie
d9a199ca0d
exceptions.ValidationFailed, not Django's ValidationError
2014-10-10 14:16:09 +01:00
Tom Christie
5d247a65c8
First pass on nested serializers in HTML
2014-10-09 15:11:19 +01:00
Tom Christie
f7d43f530a
Limit blank string -> None to just be on relational fields
2014-10-08 17:03:14 +01:00
Tom Christie
5ead8dc89d
Support empty file fields
2014-10-08 16:59:52 +01:00
Tom Christie
093febb912
Tests for relational fields
2014-10-08 11:04:08 +01:00
Tom Christie
6bfed6f852
Enforce uniqueness validation for relational fields
2014-10-07 17:04:53 +01:00
Tom Christie
dd47d8aa45
Merge pull request #1921 from koordinates/fix-typos
...
Minor: fix spelling and grammar, mostly in 3.0 announcement
2014-10-03 09:24:26 +01:00
Craig de Stigter
dfab9af294
Minor: fix spelling and grammar, mostly in 3.0 announcement
2014-10-03 08:41:18 +13:00
Tom Christie
fec7c4b458
Browsable API tweaks
2014-10-02 18:13:15 +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
381771731f
Use six.text_type instead of str everywhere
2014-10-01 13:09:14 +01:00
Tom Christie
d1b2c8ac7f
Absolute URLs for file fields
2014-09-29 14:12:26 +01:00
Tom Christie
d2d412993f
.validate() on serializer fields
2014-09-29 11:24:21 +01:00
Tom Christie
43fd5a8730
Uniqueness validation
2014-09-29 09:24:03 +01:00
Tom Christie
dee3f78cb6
FileField and ImageField
2014-09-26 17:06:20 +01:00
Tom Christie
6090144608
Simplify serialization slightly
2014-09-26 14:32:44 +01:00
Tom Christie
2e87de0143
Added ListField
2014-09-26 13:08:20 +01:00
Tom Christie
2859eaf524
request.data attribute
2014-09-26 10:46:52 +01:00
Tom Christie
417fe1b675
Partial support
2014-09-25 13:37:26 +01:00
Tom Christie
3a5335f09f
Fix syntax error
2014-09-25 13:12:02 +01:00
Tom Christie
8ee92f8a18
Refuse to downcast from datetime to date or time
2014-09-25 13:10:33 +01:00
Tom Christie
b47ca158b9
Check for redundant on SerializerMethodField
2014-09-25 12:09:12 +01:00
Tom Christie
64632da371
Clean up bind - no longer needs to be called multiple times in nested fields
2014-09-25 11:40:32 +01:00
Tom Christie
1420c76453
Ensure proper sorting of 'choices' attribute on ChoiceField
2014-09-25 10:49:25 +01:00
Tom Christie
fb1546ee50
Enforce field_name != source
2014-09-24 20:53:37 +01:00
Tom Christie
127c0bd3d6
Custom deepcopy on Field classes
2014-09-24 20:25:59 +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
5d80f7f932
allow_blank, allow_null
2014-09-22 17:46:02 +01:00
Tom Christie
5a95baf2a2
Tests & tweaks for ChoiceField
2014-09-22 16:52:57 +01:00
Tom Christie
b5454dd022
Tests and tweaks for choice fields
2014-09-22 16:50:04 +01:00
Tom Christie
e5f0a97595
More compat fixes
2014-09-22 16:45:06 +01:00
Tom Christie
5586b6581d
Support format=None for date/time fields
2014-09-22 16:02:59 +01:00
Tom Christie
4db23cae21
Tweaks to DecimalField
2014-09-22 15:34:06 +01:00
Tom Christie
249253a144
Fix compat issues
2014-09-22 14:54:33 +01:00
Tom Christie
c54f394904
Ensure 'messages' in fields are respected in preference to default validator messages
2014-09-22 13:57:45 +01:00
Tom Christie
afb3f8ab0a
Tests and tweaks for text fields
2014-09-22 13:26:47 +01:00
Tom Christie
af46fd6b00
Field tests and associated cleanup
2014-09-22 12:25:57 +01:00
Tom Christie
5b7e4af0d6
get_base_field() refactor
2014-09-18 11:20:56 +01:00
Tom Christie
40dc588a37
Drop label from serializer fields when not needed
2014-09-15 09:50:51 +01:00
Tom Christie
e6c88a4233
Drop usage of validatiors.EMPTY_VALUES
2014-09-12 19:54:27 +01:00
Tom Christie
79715f01f8
Coerce dates etc to ISO_8601 in seralizer, by default.
2014-09-12 12:10:22 +01:00
Tom Christie
5e39e159ee
UNICODE_JSON and COMPACT_JSON settings
2014-09-12 11:38:22 +01:00
Tom Christie
250755def7
Clean up relational fields queryset usage
2014-09-12 10:59:51 +01:00
Tom Christie
0d354e8f92
to_internal_value() and to_representation()
2014-09-12 09:49:35 +01:00
Tom Christie
adcb64ab41
MethodField -> SerializerMethodField
2014-09-12 09:12:56 +01:00
Tom Christie
1e53eb0aa2
DecimalFields should still be quantized even without coerce_to_string
2014-09-11 21:57:32 +01:00
Tom Christie
040bfcc09c
NotImplemented stubs for Field, and DecimalField improvements
2014-09-11 21:48:54 +01:00
Tom Christie
de301f3b66
Merge master
2014-09-11 13:20:44 +01:00
Tom Christie
80ba047347
Compat fixes
2014-09-10 16:57:22 +01:00
Tom Christie
01c8c0cad9
Added help_text argument to fields
2014-09-10 13:52:16 +01:00
Tom Christie
234369aefd
Tweaks
2014-09-10 08:53:33 +01:00
Tom Christie
b1c07670ca
Fleshing out serializer fields
2014-09-09 17:46:28 +01:00
Tom Christie
21980b800d
More test sorting
2014-09-08 14:24:05 +01:00
Christopher Adams
613a301a36
Fixed #1533 - Resolved issue with integer keys on nested choices never validating.
...
- Added unit test for nested `choices` argument.
- Added unit test for non-nested `choices` argument.
2014-09-06 17:13:28 -04:00
Tom Christie
d934824bff
Workin on
2014-09-05 16:29:46 +01:00
Piotr Jakimiak
c3b841ae44
Use Serializer instead of ModelSerializer
2014-09-05 14:08:11 +02:00
Piotr Jakimiak
6022b9ddd4
Fix comment
2014-09-05 12:00:17 +02:00
Piotr Jakimiak
d9633c6817
Fix returning None when allow_none is True in CharField
2014-09-05 11:08:34 +02:00
Tom Christie
f2852811f9
Getting tests passing
2014-09-02 17:41:23 +01:00
Tom Christie
ec096a1cac
Add relations and get tests running
2014-09-02 15:07:56 +01:00
Tom Christie
4ac4676a40
First pass
2014-08-29 16:46:26 +01:00
Tom Christie
63d02dbea8
Drop six from compat. 1.4.2 is now the lowest supported version.
2014-08-19 17:06:55 +01:00
Tom Christie
d2795dd26d
Resolve linting issues
2014-08-19 13:54:52 +01:00
Xavier Ordoquy
4876bec9f5
Merge remote-tracking branch 'origin/master' into 2.4.0
...
Conflicts:
rest_framework/fields.py
2014-07-26 00:06:56 +02:00
Serhiy Voyt
3326ddc865
Merge branch 'master' into modelserialization-charfield-with-null
2014-06-27 18:10:50 +03:00
Xavier Ordoquy
2489e38a06
Merge remote-tracking branch 'origin/master' into 2.4.0
...
Conflicts:
.travis.yml
docs/api-guide/viewsets.md
rest_framework/serializers.py
rest_framework/throttling.py
tests/test_generics.py
tests/test_serializers.py
tox.ini
2014-06-23 14:02:45 +02:00
TankorSmash
544183f64f
typo in the docs
2014-06-16 19:13:02 -04:00
khamaileon
08c4594145
Replace ChoiceField type_label
2014-06-05 12:49:02 +02:00
John Spray
04c820b8e5
fields: allow help_text on SerializerMethodField
...
...by passing through any extra *args and **kwargs
to the parent constructor.
Previously one couldn't assign help_text to a
SerializerMethodField during construction.
2014-05-22 15:24:35 +01:00
Tom Christie
218b94e606
Merge pull request #1536 from Ian-Foote/choicefield_blank_display_value
...
Allow customising ChoiceField blank display value
2014-05-20 16:03:51 +01:00
Carlton Gibson
d69d975015
Merge pull request #1564 from alumni/master
...
Fixes #1535 (HTML widget missing `id` attribute)
2014-05-09 10:36:06 +02:00
Carlton Gibson
591d5240da
Merge pull request #1575 from ewdicus/iso8601
...
Add colon to time zone offset in readable_datetime_formats
2014-05-08 09:34:06 +02:00
Elliott
11115fde9c
Add colon to time zone offset in readable_datetime_formats
2014-05-07 11:37:20 -07:00
Serhiy Voyt
27be31bd8a
In case of None value returns empty string instead of NoneType.
2014-05-07 18:37:08 +03:00
Serhiy Voyt
1ce1f387b0
Charfied from_native method returns default instead of None. Updated tests.
2014-05-06 21:57:25 +03:00
Lucian Mocanu
4e33ff05d9
Automatically set the field name as value for the HTML id
attribute on the rendered widget.
2014-05-04 00:12:08 +02:00
Xavier Ordoquy
56b4390316
Merge remote-tracking branch 'origin/master' into 2.4.0
...
Conflicts:
.travis.yml
rest_framework/serializers.py
rest_framework/tests/test_authentication.py
2014-04-30 22:21:26 +02:00
Kamil Niski
82094554e5
Minor typo
2014-04-27 02:54:47 +02:00
Ian Foote
6c108c459d
Allow customising ChoiceField blank display value
2014-04-16 12:32:04 +01:00
Xavier Ordoquy
d08536ad9d
Merge remote-tracking branch 'origin/master' into 2.4.0
...
Conflicts:
.travis.yml
docs/api-guide/fields.md
docs/api-guide/routers.md
docs/topics/release-notes.md
rest_framework/authentication.py
rest_framework/serializers.py
rest_framework/templatetags/rest_framework.py
rest_framework/tests/test_authentication.py
rest_framework/tests/test_filters.py
rest_framework/tests/test_hyperlinkedserializers.py
rest_framework/tests/test_serializer.py
rest_framework/tests/test_testing.py
rest_framework/utils/encoders.py
tox.ini
2014-04-13 00:05:57 +02:00
Mauro de Carvalho
2a1571b3bf
Fixed comment.
2014-04-07 18:27:59 -03:00
Anton Shutik
1addd09e2b
RelatedField default value handling fixed
2014-02-27 18:34:36 +03:00
Carlton Gibson
f1016441f5
Test and fix for #1210 . World's lowest hanging fruit.
2014-02-11 19:52:32 +01:00
Tom Christie
e9fda70b4a
Nicer write_only fields implementation. Closes #1355
2014-01-15 08:53:23 +00:00
Tom Christie
85d74fc86a
Added write_only and write_only_fields. Refs #1306
2014-01-14 11:25:44 +00:00
Yuri Prezument
6e622d644c
CharField - add allow_null argument
2014-01-12 10:53:54 +02:00
Yuri Prezument
e88e3c6ae1
Possible fix for #1330
...
Coerce None to '' in CharField.to_native()
2014-01-12 10:53:54 +02:00
Tom Christie
52686420f4
Merge branch 'bennbollay-patch-1' into 2.4.0
...
Conflicts:
.travis.yml
docs/api-guide/routers.md
rest_framework/compat.py
tox.ini
2013-12-23 09:48:59 +00:00
Kevin Brown
90edcbf938
Fix default values always being False for browsable API
...
This fixes a bug that was introduced in 28ff6fb
[1] for the
browsable API, specifically with how it handled default values
for boolean fields. Previously, it had a global default for
boolean fields set to `False`, which was different than the
standard None that was used elsewhere. Because this only needed
to be done for the browsable API, a fix was put into place that
only set the default to `False` when form data was passed into
the serializer. This had the unintended side effect of overriding
any default set on the boolean field.
This fixes #1101 [2] by only overriding the default if the default is
`None`, which is the default for all fields.
[1]: 28ff6fb1ec
[2]: https://github.com/tomchristie/django-rest-framework/issues/1101
2013-12-13 13:20:29 -05:00
Tom Christie
9c41c007af
Merge branch 'master' into 2.4.0
...
Conflicts:
.travis.yml
docs/api-guide/routers.md
docs/topics/release-notes.md
rest_framework/compat.py
2013-12-13 16:32:34 +00:00
Tom Christie
344cd865ab
Merge pull request #1250 from Ian-Foote/choice_field
...
Add choices to options metadata for ChoiceField.
2013-12-03 08:03:02 -08:00
Omer Katz
b8f8fb7779
Updated the assertion message of the ImageField.
2013-11-27 13:26:49 +02:00
Ian Foote
8d09f56061
Add unittests for ChoiceField metadata.
...
Rename 'name' to 'display_name'.
2013-11-27 11:06:42 +00:00
Ian Foote
2484fc9141
Add more context to the ChoiceField metadata.
2013-11-26 17:10:16 +00:00
Ian Foote
a38d9d5b24
Add choices to options metadata for ChoiceField.
2013-11-26 09:33:47 +00:00
Mathieu Pillard
5325890821
Improve handling of 'empty' values for ChoiceField
...
The empty value defaults back to '' (for backwards-compatibility) but
is changed automatically to None for ModelSerializers if the `null`
property is set on the db field.
2013-11-05 17:21:18 +01:00
Tom Christie
c3e370b168
Merge branch 'html-form-rendering'
2013-10-10 17:33:39 +01:00
Tom Christie
9e29c63895
Ensure read-only fields don't break with current HTML renderer behavior
2013-10-10 17:33:22 +01:00
Tom Christie
a14f1e8864
Serializers can now be rendered directly to HTML
2013-10-02 13:45:35 +01:00
Tom Christie
e441f85109
Drop 1.3 support
2013-09-25 10:30:04 +01:00
Philip Douglas
272a6abf91
Try a more localised fix to the data=None problem
2013-09-13 10:46:24 +01:00
Tom Christie
9a5b2eefa9
Merge master
2013-08-30 09:28:33 +01:00
Mathieu Pillard
11071499a7
Make ChoiceField.from_native() follow IntegerField behaviour on empty values
2013-08-29 18:10:47 +02:00
Tom Christie
47d17b088a
Merge branch 'fix_937' of git://github.com/aburgel/django-rest-framework into aburgel-fix_937
2013-08-23 11:56:22 +01:00
Tom Christie
16ffdedd14
Merge master
2013-08-21 21:31:59 +01:00
Tom Christie
28ff6fb1ec
Only HTML forms should have implicit default False for boolean fields
2013-08-19 21:44:47 +01:00
Tom Christie
28e44efe25
Merge branch 'master' into 2.4.0
2013-08-19 20:58:28 +01:00
JT
2f03870ae1
Fix for "No module named compat"
2013-08-13 18:48:49 -05:00
Alex Burgel
db9672d304
Add support for removing field files by sending an empty string
2013-07-24 17:24:29 -04:00
Pavel Zinovkin
2e18fbe373
Updated EmailField error message. This one already available in django translations.
...
https://github.com/django/django/blob/master/django/conf/locale/ru/LC_MESSAGES/django.po#L343
2013-07-21 17:03:58 +04:00
Tom Christie
8f79caf9d1
Use 'force_text', not 'unicode', for compat across python version
2013-07-05 09:07:18 +01:00
Andy Freeland
7d43f41e4a
Remove 'Hold down "Control" ...' message from help_text
...
When getting the help_text from a field where `many=True`, Django
appends 'Hold down "Control", or "Command" on a Mac, to select more than
one.' to the help_text. This makes some sense in Django's ModelForms,
but no sense in the API.
2013-07-04 01:51:24 -04:00
Tom Christie
3fcc01273c
Remove deprecated code
2013-06-27 20:29:52 +01:00
David Sanders
fcaca73709
Pep8 lint
2013-06-11 16:10:25 -06:00
David Sanders
656897c2da
Update ModelField to work with a broader range of fields
...
Add support for fields that use min and max value validators.
2013-06-11 16:09:32 -06:00
Tom Christie
40e09472d8
Never deepcopy validators. Closes #913
2013-06-06 08:56:39 +01:00
Tom Christie
b15a6ccef2
Serializer field 'default' argument may be a callable
2013-06-02 20:12:49 +01:00
Gustavo Andrés Angulo
de1cc5f8c1
Fix default field when is a simple callable function.
2013-05-29 11:45:54 -05:00
Tom Christie
fcaee6e580
Clean up OPTIONS implementation
2013-05-24 23:44:23 +01:00
Tom Christie
760e8642bd
Merge branch 'issue-192-expose-fields-for-options' of https://github.com/grimborg/django-rest-framework into improved-options-support
2013-05-24 21:21:56 +01:00
Oscar Vilaplana
a1deb5eac7
simplified, moved field humanizing to Field. broken tests
2013-05-23 08:26:55 +02:00
Tom Christie
cdc3c37465
Merge and styling fixes
2013-05-21 12:01:56 +01:00
David Jones
c3fd7c6685
Updated SlugField to raise validation errors for invalid slugs
2013-05-20 13:04:38 +01:00
Oscar Vilaplana
e80488b619
Added min_length and max_length
2013-05-19 15:08:41 +02:00
Oscar Vilaplana
696c053f4f
s/Single Character/String/
2013-05-19 15:04:43 +02:00
Oscar Vilaplana
b915c1d4d8
Made field label optional in OPTIONS
2013-05-19 11:15:38 +02:00
Nikolaus Schlemm
c0f3a1c397
Integrated status quo of grimborg's awesome humanize_field() for exposing field metadata via OPTIONS :)
2013-05-19 09:25:02 +02:00
Nikolaus Schlemm
9454e23aa9
Merge branch 'master' of git://github.com/tomchristie/django-rest-framework into issue-192-expose-fields-for-options
2013-05-19 09:02:07 +02:00
Nikolaus Schlemm
843ae60237
Merge branch 'issue-192-expose-fields-for-options' of git://github.com/grimborg/django-rest-framework into issue-192-expose-fields-for-options
...
Conflicts:
rest_framework/tests/fields.py
2013-05-18 18:34:21 +02:00
Oscar Vilaplana
fecadacab1
added tests for form
2013-05-18 18:27:53 +02:00
Oscar Vilaplana
4dffcb5d77
Added humanized field names and types
2013-05-18 18:10:17 +02:00
Ryan Kaskel
579f77ceaa
Move function to compat.
2013-05-18 17:04:17 +01:00
Ryan Kaskel
33f702d306
Merge latest changes from master.
2013-05-18 16:26:17 +01:00
Ryan Kaskel
10e451a85a
Handle Python 3 strings and lazy strings.
2013-05-18 16:21:18 +01:00
Markus Törnqvist
48c1b2233b
Merge branch 'master' into mjtorn-master
...
Conflicts:
rest_framework/serializers.py
rest_framework/tests/serializer.py
Fixed conflicts
2013-05-18 18:13:31 +03:00
Stephan Groß
9f9cb97d65
Add TestCases for default field values
2013-05-18 16:24:54 +02:00
Ryan Kaskel
22874e441d
Merge latest changes from master.
2013-05-18 14:17:50 +01:00
Tom Christie
6d425aa3be
Merge pull request #831 from brianz/master
...
Allow nested fields to be missing
2013-05-18 04:36:00 -07:00
Pablo Recio
53a8004401
Merge branch 'master' into 725-blank-choice-dash
...
Conflicts:
rest_framework/tests/fields.py
2013-05-18 12:51:40 +02:00
Pablo Recio
ab8bd566f9
Adding BLANK_CHOICE_DASH
as a choice if the model's field isn't required
2013-05-18 12:41:52 +02:00
Tom Christie
a73c16b85f
serializers.Field respects ordering on dicts if it exists. Closes #832
2013-05-18 11:27:48 +01:00
Markus Törnqvist
3691cd2ffd
Use smart_text() instead of nonexistant smart_unicode()
2013-05-18 13:26:59 +03:00
Markus Törnqvist
85faebbb75
Merge branch 'mikee2185-master' into mjtorn-master
...
Conflicts:
rest_framework/fields.py
rest_framework/serializers.py
rest_framework/tests/models.py
rest_framework/tests/serializer.py
Fixed all the conflicts.
2013-05-18 13:24:36 +03:00
Brian Zambrano
24c9c455fe
Allow for missing non-required nested objects.
...
Serializer fields which are themselves serializers should not be required.
Specifically, if a nested object is set to "required=False", it should be
possible to serialize the main object and have the sub-object set to None/null.
2013-05-13 14:41:12 -07:00
Tom Christie
b443560080
Fix DATETIME_FORMAT, DATE_FORMAT, TIME_FORMAT settings. Closes #798
2013-05-08 20:38:50 +01:00
Tom Christie
dc7b1d6430
2.2's PendingDeprecationWarnings now become DeprecationWarnings. 2.3's PendingDeprecationWarnings added.
2013-04-29 12:45:00 +01:00
Tom Christie
d985aec3c9
DecimalField
2013-04-26 13:59:06 +01:00
Tom Christie
95abe6e844
Cleanup docstrings
2013-04-25 12:47:34 +01:00
Stephan Groß
cac6697025
Return Decimal instance instead of string
2013-04-15 15:24:14 +02:00
Stephan Groß
9d80f01bce
Fix init call
2013-04-15 15:15:55 +02:00
Stephan Groß
ad436d966f
Add DecimalField support
2013-04-15 13:02:18 +02:00
Matteo Suppo
b5640bb778
Forcing translations of lazy translatable strings in Field to_native method
2013-03-23 14:18:55 +01:00
Tom Christie
8adde506e8
Default date/time fields now return python date/time objects again by default
2013-03-21 08:41:54 +00:00
Tom Christie
20fd738c85
iso formated datetime aware fields with +0000 offset should use 'Z' suffix instead
2013-03-20 13:05:59 +00:00
Tom Christie
a798a5350a
Fix duplicated database queries for paginated lists.
...
Closes #713 .
2013-03-13 11:42:12 +00:00
Tom Christie
ad336cc636
Fix broken None
value for TimeField
.
...
Refs #707 .
2013-03-07 09:03:53 +00:00
Kevin Stone
2f8d8b499e
Patched DateField and DateTimeField to check for None values before trying to perform date(time) conversion.
...
Signed-off-by: Kevin Stone <kevinastone@gmail.com>
2013-03-06 15:16:37 -08:00
Tom Christie
1106596c80
Clean ups to datetime formatting
2013-03-06 12:19:39 +00:00
Tom Christie
c20ebe95f6
Merge datetime formats
2013-03-05 17:50:28 +00:00
Stephan Groß
5e5cd6f7f7
Fix for django 1.3 compatibility
2013-03-01 17:15:39 +01:00
Stephan Groß
12905449a5
Add format class attributes
2013-03-01 16:59:47 +01:00
Stephan Groß
9c964cf37b
Add new ISO8601 setting + integration
2013-03-01 16:50:18 +01:00