Commit Graph

213 Commits

Author SHA1 Message Date
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
Stephan Groß
a9d36d4726 Add docs update - part 1 2013-03-01 16:50:18 +01:00
Stephan Groß
f208d8d2bb Add drf settings + output format + testcases 2013-03-01 16:50:18 +01:00
Stephan Groß
b2165cc76a Fix for python 3 support - thanks @Linovia 2013-03-01 16:48:20 +01:00
Stephan Groß
9157db5da0 Add better date / datetime validation (pull 2)
addition to #631 with update to master + timefield support
2013-03-01 16:48:20 +01:00
Yuri Prezument
5f531fc1ea Catch TypeError as well as ValueError when parsing dates, ref #699 2013-02-21 15:54:31 +02:00
Tom Christie
367909e2c2 Merge pull request #657 from dgaus/master
Make is_simple_callable consider default arguments
2013-02-15 01:13:14 -08:00
Andreas Pelme
5a5df18d18 Added a serializer TimeField 2013-02-14 21:19:51 +01:00
Diego Gaustein
40b13a869b Make is_simple_callable consider fields which have default arguments 2013-02-13 20:34:23 -03:00
Tom Christie
f505b2e440 Clean up field_to_native logic 2013-02-12 22:59:01 +00:00
Tom Christie
670ac25b25 Allow serializers to handle dicts as well as objects. Fixes #447. 2013-02-07 12:57:40 +00:00
Marc Tamlyn
bd7977eed7 Purge naked excepts.
Most of these had obvious exceptions which would be thrown. Some I'm not
sure about but they should at least catch only Exception so as not to
ignore SystemExit and other inappropriate Error classes.
2013-02-06 13:05:17 +00:00
Tom Christie
8e846bdf52 Merge branch 'py3k' into 2.2
Conflicts:
	rest_framework/relations.py
	rest_framework/serializers.py
	rest_framework/tests/relations_hyperlink.py
	rest_framework/tests/relations_slug.py
2013-02-04 20:37:09 +00:00
Tom Christie
d9c7b1c585 Merge branch 'p3k' of https://github.com/linovia/django-rest-framework into working
Conflicts:
	rest_framework/authentication.py
	rest_framework/relations.py
	rest_framework/serializers.py
	rest_framework/settings.py
	rest_framework/tests/authentication.py
	rest_framework/tests/genericrelations.py
	rest_framework/tests/generics.py
	rest_framework/tests/relations_hyperlink.py
	rest_framework/tests/relations_nested.py
	rest_framework/tests/relations_pk.py
	rest_framework/tests/serializer.py
2013-02-01 11:58:55 +00:00
Tom Christie
e4ac566625 Add dprecation warnings 2013-01-30 20:33:50 +00:00
Tom Christie
be6df3ae3c Merge branch 'master' into many-fields
Conflicts:
	rest_framework/relations.py
2013-01-30 13:41:56 +00:00
Tom Christie
9a4d01d687 Formatting fixes 2013-01-30 12:41:26 +00:00
Tom Christie
7ed81c3c66 Tweak comment. 2013-01-03 22:06:55 +00:00
Tom Christie
6da21fa796 Merge pull request #541 from yprez/default_and_partial_serializers2
Fix "default" values and partial serializers.  Fixes #532.
2013-01-03 14:05:36 -08:00
Xavier Ordoquy
60250f22c8 Move the various compat things to the compat module. 2013-01-03 11:41:07 +01:00
Yuri Prezument
3f5e938247 Some cleanup 2013-01-03 08:28:17 +02:00
Yuri Prezument
f2625fc38c FileField validation - handle case when files=None, fixes #542 2013-01-02 22:12:26 +02:00
Xavier Ordoquy
45d48dd52f urlparse not used here. 2013-01-02 18:54:55 +01:00
Xavier Ordoquy
737349d238 Merge remote-tracking branch 'reference/py3k' into p3k 2013-01-02 16:09:21 +01:00
Yuri Prezument
3873bc8a85 Add explaining comment 2013-01-02 15:57:00 +02:00
Yuri Prezument
6b962cfcf7 Fix "default" and partial serializers, fixes #532 2013-01-02 15:56:46 +02:00
Tom Christie
8fad0a727a Relation fields move into relations.py 2012-12-31 08:53:40 +00:00
Michal Dvorak
5d7d51ed9d Merge remote-tracking branch 'upstream/master' 2012-12-23 22:05:16 +01:00
Mark Aaron Shirley
f8a1256b1c Update RelatedField#field_from_native coding style 2012-12-21 11:33:01 -08:00
Michal Dvorak (cen38289)
5ba2437f2d Merge remote-tracking branch 'tom/master'
Conflicts:
	rest_framework/tests/serializer.py
2012-12-21 10:53:23 +01:00
Mark Aaron Shirley
2f5582a1a6 Merge remote-tracking branch 'upstream/master' into related-required 2012-12-19 15:24:22 -08:00
Tom Christie
46b313315a Merge pull request #510 from joual/master
Fixes #509
2012-12-19 14:39:11 -08:00
Mark Aaron Shirley
5c680c36e4 Check if RelatedField is required. 2012-12-19 09:26:40 -08:00
Tom Christie
6611514134 Whitespace 2012-12-18 19:20:10 +00:00
Michal Dvorak (cen38289)
8ac77eaae8 Merge remote-tracking branch 'tom/master'
Conflicts:
	rest_framework/serializers.py
	rest_framework/tests/serializer.py
2012-12-17 17:01:00 +01:00
Joel Marcotte
262d9c2489 Final commit to restore the fix
Signed-off-by: Joel Marcotte <skaner@gmail.com>
2012-12-15 16:52:28 -05:00
Joel Marcotte
6f25181979 Reverting commit to previous state to see if the test is only relevant to django 1.5b2 2012-12-15 16:45:04 -05:00
Tom Christie
35f72cecb1 Fix model validation exclusions. Fixes #500. Fixes #506. 2012-12-15 20:40:41 +00:00
Joel Marcotte
71ccab593b Fix for JSON integer match to a ChoiceField 2012-12-15 10:35:06 -05:00
Stephan Groß
54d9cd4dba fixed validationerror usage 2012-12-13 16:44:45 +01:00
Tom Christie
4058223309 Fix broken nested fields 2012-12-11 21:07:25 +00:00
Venkat
1815cdd247 Making sure the assert does not fail when required=False, read_only=True 2012-12-10 17:46:21 -08:00
Tom Christie
ac2720afcb Add null related field option 2012-12-08 13:00:49 +00:00
Tom Christie
733f03fba3 Fix for emptystring as nullable FK 2012-12-08 12:48:38 +00:00
Tom Christie
303bc7cf95 Support nullable FKs, with blank=True 2012-12-07 21:32:45 +00:00
Tom Christie
a463ddbb37 Merge pull request #470 from minddust/fix-#469
fixed #469 - RegexField <--> BrowsableAPI Bug
2012-12-06 14:58:18 -08:00
Michael Richards
3867d9deb1 Added support for 'true'/'false' as valid boolean data 2012-12-04 11:07:31 -08:00
Michal Dvorak (cen38289)
2a82b64963 Moved smart_unicode to Field ctor, to mimic Django Forms behavior. 2012-12-04 14:22:41 +01:00
Stephan Groß
e044fa089b fixed #469 - RegexField <--> BrowsableAPI Bug 2012-12-04 09:40:23 +01:00
Michal Dvorak
dea0f9129c Fixed screwed formatting 2012-12-03 19:10:57 +01:00
Michal Dvorak (cen38289)
9ae0ca1cae #467 Added label and help_text to Field 2012-12-03 17:26:01 +01:00
Xavier Ordoquy
5fad46d7e2 Merge remote-tracking branch 'reference/master' into p3k 2012-12-02 12:43:32 +01:00
Marko Tibold
968f4a5ca4 Merge branch 'custom-serializer-form-class' of https://github.com/ludwigkraatz/django-rest-framework into mergebranch#390
Conflicts:
	rest_framework/fields.py
	rest_framework/renderers.py
Manually solved
2012-11-29 01:10:32 +01:00
Xavier Ordoquy
e348ee9255 52 tests passing. Refactored a few string / byte io. 2012-11-23 01:12:33 +01:00
Tom Christie
ec437e3e0f Merge pull request #441 from dbachrach/master
Add widgets for DateField and DateTimeField
2012-11-22 02:17:20 -08:00
Xavier Ordoquy
b3698acb6c First passing test under p3k \o/ 2012-11-22 00:20:49 +01:00
Mark Aaron Shirley
0876bed963 Merge remote-tracking branch 'upstream/master' into partial-update 2012-11-21 09:37:22 -08:00
Mark Aaron Shirley
1adfc41dc7 partial argument should override required 2012-11-21 09:36:37 -08:00
Stephan Groß
6ba4df8a27 Merge remote-tracking branch 'upstream/master' into regex_field
Conflicts:
	docs/topics/release-notes.md
2012-11-21 11:56:34 +01:00
Tom Christie
8e8b23b6a9 Merge pull request #430 from j4mie/serializer-method-field
Serializer method field
2012-11-20 15:30:30 -08:00
Mark Aaron Shirley
c3644234cd Add support for partial serializer updates 2012-11-20 11:01:21 -08:00
Dustin Bachrach
7bf03bbd66 Add widgets for DateField and DateTimeField. 2012-11-20 08:27:52 -08:00
Stephan Groß
86484668f6 added RegexField 2012-11-20 15:38:50 +01:00
Jamie Matthews
de5b071d67 Add SerializerMethodField 2012-11-19 17:22:17 +00:00
Jacob Magnusson
d67ee708e5 Add support for min_length / max_length keywords
on basic ModelFields
2012-11-18 18:14:21 +01:00
Tom Christie
e801e21210 Merge pull request #422 from markotibold/max_length_for_modelserializers
Max length for modelserializers
2012-11-16 14:54:16 -08:00
Marko Tibold
1a436dd6d9 Added URLField and SlugField.
Fixed test_modelserializer_max_length_exceeded
2012-11-16 22:43:16 +01:00
Marko Tibold
403886b79b Merge commit '3b258d69c92e9d9293f7c5d1690f0ca434e677e3' into file_and_image_fields 2012-11-15 22:48:22 +01:00
Marko Tibold
e112a806d8 .to_native() now returns the file-name. 2012-11-14 21:40:52 +01:00
Marko Tibold
c35b9eb065 Processed review comments.
No type checking in .restore_fields()
Added missing BytesIO import.
2012-11-14 21:13:23 +01:00
Stephan Groß
44ff2e0add fixed some typos 2012-11-14 19:36:29 +01:00
Marko Tibold
8cdbc0a33a Properly render file inputs in the Browsable api. 2012-11-14 00:09:39 +01:00
Marko Tibold
5443dd5f3c Added a FileField and an ImageField (copied from django.forms.fields).
Adjusted generics, mixins and serializers to take a `files` arg where applicable.
2012-11-13 23:26:17 +01:00
Marko Tibold
2a2ce406bc Fixes #380 2012-11-10 12:23:19 +01:00
Ludwig Kraatz
5cd64cc551 Fields specify what FormFieldClass should be used by BrowsableApiRenderer
added SerializerField Attribute "form_field_class" and defaults for
existing Fields
2012-11-08 16:02:03 +01:00
Stephan Groß
f3c94acc4a fixed typo 2012-11-07 17:19:13 +01:00
Tom Christie
6d3bb67aa6 Add pk_url_kwarg to hyperlinked fields 2012-11-06 17:11:52 +00:00
Stephan Groß
2c52a2581f added slug support for HyperlinkedIdentityField 2012-11-06 17:02:34 +01:00