Tom Christie
1f55bc747b
Merge pull request #2926 from tomchristie/admin-style
...
Admin style renderer
2015-07-30 15:01:37 +01:00
Ion Scerbatiuc
d4353cc1fd
Moved the code comment inside the if block and removed whitespace
2015-07-27 07:57:05 -07:00
Ion Scerbatiuc
0386a01673
Addressed CR comments
2015-07-27 07:45:35 -07:00
Ion Scerbatiuc
47a22a55ca
Added a possible fix
2015-07-25 09:44:00 -07:00
Tom Christie
b996266431
Merge master
2015-07-23 15:28:29 +01:00
Tom Christie
264d423493
Added allow_empty flag for ListField, ListSerializer, ManyRelation, MultipleChoiceField.
2015-07-16 13:51:15 +01:00
Tom Christie
c14ad7add7
Handle .choices for related fields when queryset argument is actually a mamanger instance. Closes #3145 .
2015-07-14 13:31:24 +01:00
Tom Christie
bca2ea35df
Ensure that realtionship fields '.choices' returns an empty dict when accessed with a read-only field. Closes #2910 .
2015-07-14 13:21:08 +01:00
Tom Christie
055986b5b0
More helpful exception when URL cannot reverse and field value was empty. Closes #2698 .
2015-07-02 11:36:14 +01:00
Venelin Stoykov
c3c9a712fa
Fix ManyRelatedField.choices
...
Use choices from self.child_relation.
We don't need to repeat ourself because can get out of sync.
2015-06-29 15:35:55 +03: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
47765bc429
Merge pull request #3034 from m-vellinga/master
...
Use get_queryset() for RelatedField choices property
2015-06-25 16:41:43 +01:00
Brian Grohe
51cda112f5
Simplified if statement to one line solution
...
Based on feedback on the pull request, changed solution to
be simpler for issue 3042
2015-06-19 09:21:35 -04:00
Brian Grohe
d24990ece2
Fixed many=False issue in related fields
...
Added check to pop many from kwargs before passing to __init__
Fixed my lint issue from the previous commit
2015-06-17 13:48:34 -04:00
Thomas Stephenson
a1e0bae9da
Custom serialization of PrimaryKeyRelatedField values
...
Adds a 'pk_field' parameter which can be used to proxy serialization and
deserialization of arbitrary primary key values.
2015-06-15 04:43:49 +10:00
Tom Christie
b1b47036d7
Use six.text_type for hyperlink names
2015-06-03 11:53:27 +01:00
Tom Christie
90f2e26679
Add Hyperlink and rendering in admin style renderer
2015-06-03 11:00:38 +01:00
Marco Vellinga
478b1dbd06
Use get_queryset() for RelatedField choices property instead of self.queryset.all()
2015-05-11 15:28:10 +02:00
Devon Bleibtrey
b1c1867b16
Swapping to hassattr logic for pk attribute references in relations
2015-03-23 11:40:33 -04:00
Devon Bleibtrey
7ac3c3fff7
Added enhancement for pk reference in many=True relations
2015-03-23 10:42:42 -04:00
Devon Bleibtrey
8a58b1a380
Added ability to define backend identification attribute
2015-03-22 13:50:05 -04:00
Matt d'Entremont
fb58ef043c
Add support for serializing models with m2m related fields
...
- In both ManyRelatedField, provide an empty return when trying to
access a relation field if the instance in question has no PK (so
likely hasn't been inserted yet)
- Add relevant tests
- Without these changes, exceptions would be raised when trying to
serialize the uncreated models as it is impossible to query
relations without a PK
- Add test to ensure RelatedField does not regress as currently
supports being serialized with and unsaved model
2015-03-06 12:50:37 -04:00
Tom Christie
e1c4513312
Fix NamespaceVersioning with hyperlinked serializer fields
2015-02-05 00:58:09 +00:00
Brandon Cazander
77d061d234
Provide rest_framework.resolve. Fixes #2489
2015-02-02 20:37:33 -08:00
Tom Christie
4ee4b4f2dc
Merge master
2015-01-30 14:00:25 +00:00
Susan Dreher
8c3f82fb18
🐛 ManyRelatedField get_value clearing field on partial update
...
A PATCH to a serializer's non-related CharField was clearing an ancillary StringRelatedField(many=True) field.
The issue appears to be in the ManyRelatedField's get_value method, which was returning a [] instead of empty
when the request data was a MultiDict.
This fix mirrors code in fields.py, class Field, get_value, Ln. 272, which explicitly returns empty on a partial update.
Tests added to demonstrate the issue.
2015-01-27 16:18:51 -05:00
Tom Christie
6065cdbd93
Merge master
2015-01-19 15:16:57 +00:00
Tom Christie
4ce4132e08
Preserve ordering on relationship drop-down choices. Closes #2408 .
2015-01-14 12:56:03 +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
426547c61c
str() -> six.text_type(). Closes #2290 .
2014-12-17 13:39:35 +00:00
Tom Christie
1e336ef30d
Move comment
2014-12-10 22:10:45 +00:00
Tom Christie
9d3810f313
Drop get_iterable()
2014-12-10 22:09:24 +00:00
Tom Christie
ca7b1f6d51
Optimizations play nicely with select_related, prefetch_related
2014-12-10 21:09:45 +00:00
Tom Christie
720a37d3de
Hyperlinked PK optimization. Closes #1872 .
2014-12-09 17:28:56 +00:00
Tom Christie
4034793383
Added missing translation markers in realtions.py. Closes #2231 .
2014-12-08 15:13:59 +00:00
Tymur Maryokhin
d9930181ee
Removed unused imports, pep8 fixes, typo fixes
2014-12-05 00:29:28 +01:00
Tymur Maryokhin
95af92ca01
Removed custom urlparse compat
2014-12-04 15:47:42 +01:00
Tymur Maryokhin
d54c67d79d
Removed custom StringIO, force_text, smart_text compat
2014-12-04 03:11:42 +01:00
Tom Christie
786cab705a
Tweak to 3.0 relationship docs
2014-11-26 11:38:48 +00:00
Tom Christie
b4550c65dd
Docstring for 'many_init'
2014-11-26 11:30:28 +00:00
Tom Christie
992330055e
Refactor many
2014-11-13 21:11:13 +00:00
Tom Christie
fd97d9bff8
Use select inputs for relationships. Closes #2058 .
2014-11-13 19:35:03 +00:00
Tom Christie
51d86a6505
Support dotted source on relational fields
2014-11-07 16:05:07 +00:00
Tom Christie
49fae23000
Pass through kwargs to both Serializer and ListSerializer
2014-11-05 15:23:13 +00:00
Tom Christie
3af5df1955
Performance for PK fields
2014-10-16 20:47:57 +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