Commit Graph

2539 Commits

Author SHA1 Message Date
Tom Christie
c879aaf398 page_size needs to be stored as state on CursorPagination. Refs 3147. 2015-07-16 10:26:16 +01:00
Tom Christie
a9f1d99cb5 Fix 'metadata' action on viewsets. Closes #3158. Closes #3157. Closes #3115. 2015-07-16 10:08:22 +01:00
Tom Christie
6b08e97b6a Form fields should use textual only value representations. Closes #3139. Closes #2416. Closes #2558. 2015-07-14 15:47:13 +01:00
Tom Christie
132eab7bbd Raise helpful error when erronously including nested data in multipart post requests with test client. Closes #2919. 2015-07-14 14:49:44 +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
1b51bcdbae Merge branch 'master' of github.com:tomchristie/django-rest-framework 2015-07-14 13:21:20 +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
9c952dcfe9 Merge pull request #3147 from tomchristie/uploadcare-cursor-limits
Add `get_page_size` hook to `CursorPagination`
2015-07-14 12:44:13 +01:00
Tom Christie
468361425d page_size should be local, not overwriting class attribute. 2015-07-14 12:32:27 +01:00
Tom Christie
3c57e08f62 Clarifications to read_only fields. Closes #3064. 2015-07-14 12:22:51 +01:00
Tom Christie
2b51d5594b Remove whitespace and comment changes 2015-07-14 11:41:25 +01:00
Tom Christie
14a32ae32d Add get_page_size hook to CursorPagination. Closes #3068. 2015-07-14 11:40:15 +01:00
Tom Christie
1d012aeb93 Merge branch 'cursor-limits' of https://github.com/uploadcare/django-rest-framework into uploadcare-cursor-limits 2015-07-14 11:37:18 +01:00
Tom Christie
209bcb9087 Added url_field_name class attribute to ModelSerializer. Closes #3106. 2015-07-14 11:21:33 +01:00
Tom Christie
538ffaf6c7 Store self.action='metadata' for OPTIONS requests on viewsets. Closes #3115. 2015-07-14 11:13:26 +01:00
homm
a3afcfb6d3 duplicate get_page_size and related properties from PageNumberPagination 2015-07-13 14:44:48 +03:00
homm
59905e9335 revert BasePageSizePagination class and CursorPagination inheritance 2015-07-13 14:36:47 +03:00
Juan Gutierrez
b0c5f9db2f allow a non-required nested serializer to validate correctly when receiving multipart data 2015-07-03 12:28:48 -04:00
Max Peterson
ee2afb83e2 Fix 1.4 tests and make flatten_choice a utility. 2015-07-03 13:56:49 +01:00
Max Peterson
56b3f19605 Add support for grouped choices.
This also adds support for mixing single and paired choices:
```
[
    ('poor', 'Poor quality'),
    'medium',
    ('good', 'Good quality'),
]
```
2015-07-03 12:27:01 +01:00
Julien Syx
2b979d4356 Adding recursion on child of List Field 2015-07-02 14:15:43 +02:00
Tom Christie
8d69c4c068 Improve OPTIONS descriptions for lists dicts and nested serializers 2015-07-02 12:55:42 +01:00
Tom Christie
e6ca0fcb4c Remove erronous newline 2015-07-02 11:53:05 +01:00
Tom Christie
37815920e3 Update to master and tweak remaining issues 2015-07-02 11:50:40 +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
Tom Christie
c4f908d4ee Introduce datetime_parser as class level attribute on all date/time fields. Refs #3093. 2015-07-02 11:23:52 +01:00
Tom Christie
6ce9e3baf0 Remove datetime_parser argument from DateTimeField 2015-07-02 11:22:18 +01:00
Tom Christie
6d79ea2cde Merge pull request #3093 from sorreltree/master
Ability to customize DateTimeField with a custom datetime_parser
2015-07-02 11:21:25 +01:00
Tom Christie
fb4233736f Empty settings should also be coerced to lists. Closes #3087. 2015-07-02 10:28:46 +01:00
Tom Christie
d979dc6522 Tweak exception message 2015-07-02 10:16:43 +01:00
Tom Christie
e3c3d8826f Merge pull request #3071 from antonyc/patch-1
Made exception message more verbose
2015-07-02 10:14:01 +01:00
Tom Christie
39ed03c21c Merge pull request #3088 from atleta/master
Handle AttributeError as well (when the imported module exists but the specified function/class does not).
2015-07-02 09:52:53 +01:00
Tyler Redzko
af08c70242 Update extra_kwargs on model serializer
Ensures that the 'read_only' and 'required' keys from `extra_kwargs` are
retained when present. Closes #3091.
2015-07-01 10:10:18 -04:00
Michael Bacon
5f40ab53de Ability to customize DateTimeField with a custom datetime_parser 2015-06-30 14:51:47 -04:00
Laszlo Marai
f0bced6413 Handle AttributeError as well (when the imported module exists but
the specified function/class does not).
2015-06-30 05:49:44 +02: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
Shtarev
e8b23c4789 thin logic 2015-06-25 21:14:00 +03: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
José Padilla
d6e30c75ff Add test and fix for #2704 2015-06-25 09:35:36 -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
Tom Christie
8329411cc3 Merge pull request #2539 from donewell/permission-detail
add message to custom permission
2015-06-24 11:32:02 +01: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
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
homm
30b36a594f use PageSizePaginationMixin for CursorPagination
tests for custom page_size in CursorPagination
2015-06-23 19:14:10 +03:00
homm
60656e9182 merge CursorPagination.decode_cursor and _decode_cursor
merge `CursorPagination.encode_cursor` and `_encode_cursor`
2015-06-23 19:00:42 +03:00
homm
9a5373d41c make PageSizePaginationMixin from all this page_size stuff 2015-06-23 18:19:38 +03:00
homm
ab03729b58 allow cursor format customization 2015-06-23 18:00:26 +03:00
José Padilla
83ef64dbf5 Document setting URL_FORMAT_OVERRIDE to None
This also hides the format dropdown from the
Browsable API if URL_FORMAT_OVERRIDE is disabled.

Closes #3057
2015-06-23 07:50:44 -04:00
Tom Christie
1e678791de Merge pull request #2922 from thedrow/patch-11
Cache fields list for to_internal_value and to_representation
2015-06-23 08:53:32 +01:00
Tom Christie
e3b578258a Merge pull request #2769 from nonZero/patch-1
Wrong error message on bad field lookup
2015-06-22 17:04:04 +01:00
Tom Christie
15a386e85d Merge pull request #3045 from paxnovem/issue_3042
Fixed many=False issue on related fields
2015-06-22 15:40:59 +01:00
Markus Korn
b42b16d0e6 compat: invert logic for checking the django version when implementing
RequestFactory.generic()
2015-06-22 16:13:42 +02:00
Markus Korn
06c61fc511 compat: only add compat implementation of RequestFactory.generic() if not
provided by django
2015-06-22 14:05:56 +02:00
Omer Katz
1701ddae35 Fixed formatting of _readable_fields list comprehension to match the formatting of the _writable_fields list comprehension. 2015-06-20 08:51:03 +03: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
José Padilla
5e917789ec Consistent 2 space tabbing and formatting 2015-06-18 09:00:05 -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
Jannon Frank
2c415d7e03 models.TextFields get mapped to serializers.CharField too 2015-06-16 14:05:19 -07:00
Xavier Ordoquy
139ba7adeb Merge pull request #3006 from osantana/master
Handle invalid characters in "Authorization: token ..." headers
2015-06-16 22:40:15 +02:00
José Padilla
0be6d87fac Fix versioning urls 2015-06-15 16:51:37 -04:00
José Padilla
7f0acbd5a5 Merge pull request #3026 from linovia/feature/format_suffix_patterns_and_trailing_slash
`format_suffix_patterns` is applied before the trailing slash.
2015-06-15 16:38:12 -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
Kevin Brown
b0889446a5 Merge pull request #3027 from linovia/feature/url_patterns_removal
Remove `django.conf.urls.pattern`
2015-06-11 16:40:40 -04:00
Xavier Ordoquy
1e51230f1b Remove django.conf.urls.pattern as it'll be removed in Django 2.0 2015-06-11 00:45:23 +02:00
Xavier Ordoquy
e7e5946c2e format_suffix_patterns is applied before the trailing slash. 2015-06-11 00:32:05 +02:00
hellysmile
c292b3d132 Fix set_rollback on @transaction.non_atomic_requests. 2015-06-08 07:10:57 +03:00
Ash Hoover
35c28a2a71 Include correct limits in LimitOffsetPagination link urls 2015-06-05 08:56:33 -07:00
Jannon Frank
b0752217ae only include 'allow_blank' on CharField 2015-06-05 02:21:13 -07:00
Xavier Ordoquy
8935db1be9 Merge pull request #3003 from linovia/release/3.1.3
Release 3.1.3
2015-06-04 15:04:55 +01:00
Xavier Ordoquy
9a20609223 Merge pull request #3004 from linovia/translations/3.1.3
Translations updated for 3.1.3
2015-06-04 14:59:32 +01: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
Osvaldo Santana Neto
7ae71deb84 Handle invalid characters in headers 2015-06-03 14:55:34 -03:00
Xavier Ordoquy
051b86e6fd Translations updated for 3.1.3 2015-06-03 17:34:13 +01:00
Xavier Ordoquy
f3dbe9bb2a Bump to version 3.1.3 2015-06-03 16:57:18 +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
Tom Christie
b1b47036d7 Use six.text_type for hyperlink names 2015-06-03 11:53:27 +01:00
Tom Christie
99e97fa9d3 Cleanup hyperlink rendering implementation 2015-06-03 11:47:33 +01:00
Tom Christie
ae704eec58 Fix issue with pagination control always displaying 2015-06-03 11:35:03 +01:00
Tom Christie
25bb3b1502 Use chevron control for row linking, rather than hyperlinking first item 2015-06-03 11:15:54 +01:00
Tom Christie
90f2e26679 Add Hyperlink and rendering in admin style renderer 2015-06-03 11:00:38 +01:00
Shtarev
745d8d0004 added comment 2015-06-03 09:04:28 +03:00
Xavier Ordoquy
734bf3cfe6 Merge pull request #2981 from jannon/fix-model-serializer-metadata
Read-Only RelatedField Metadata Failure Test and Fix
2015-06-02 15:09:05 +01:00
Xavier Ordoquy
0c97dd1806 Merge remote-tracking branch 'reference/master' 2015-06-02 13:04:57 +01:00
Xavier Ordoquy
8fa3284620 Merge remote-tracking branch 'reference/master' 2015-06-02 10:24:28 +01:00
Jannon Frank
a97c989248 fix read_only related field metadata 2015-06-02 00:40:00 -07:00
Nicolas Delaby
c2d2417237 Tell default error handler to doom the transaction on error
if `ATOMIC_REQUESTS` is enabled.
2015-06-02 09:19:58 +02:00
Xavier Ordoquy
d79956d40e Translation update. 2015-06-02 00:20:46 +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
Xavier Ordoquy
14055dd3f4 Merge pull request #2989 from ticosax/duration-field
Add DurationField
2015-06-01 17:38:57 +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
Xavier Ordoquy
e3f856ff1d Merge pull request #2975 from sheppard/read-only-nested
can't create nested serializers for unique_together relations
2015-06-01 12:01:40 +01:00
Corentin Smith
fa29f7dd1f Fix minor typo 2015-05-30 17:57:35 +02:00
Xavier Ordoquy
ecb3ba5e1f Merge pull request #2948 from bimusiek/master
Added test ensuring DecimalField accepts `2E+2` as 200 and validates decimal place correctly.
2015-05-29 11:52:33 +02:00
S. Andrew Sheppard
8c7b5fc5c1 pop required extra_kwargs if read_only is set 2015-05-27 21:14:13 -05:00
Tom Christie
95a27a108d Merge pull request #2933 from cancan101/overide_method_action
Set the action on a view when override_method regardless of its None-ness
2015-05-27 09:10:58 +01:00
Petros Moisiadis
192719eed0 Improve coding style
On Tom's suggestion, improve coding style by using a single-line call to getattr() with a default value instead of a multi-line if/else clause.
2015-05-19 20:00:19 +03:00
Petros Moisiadis
a96ebd74b1 Fix flake8 error
Fix flake8 error
2015-05-19 19:48:53 +03:00
Petros Moisiadis
c63ea01f4f Support User model in Django 1.4 that has not a USERNAME_FIELD attribute
Support User model in Django 1.4 that has not a USERNAME_FIELD attribute.
2015-05-19 19:05:50 +03:00
Tom Christie
c916ad6315 Handle create and delete redirects 2015-05-19 16:30:45 +01:00
Petros Moisiadis
43b4ae752d Import get_user_model from compat module
Import get_user_model from compat module to be compatible with older django versions (e.g. 1.4).
2015-05-19 18:00:17 +03:00
Petros Moisiadis
a13075486d Compatibility code for getting user model
Compatibility code for getting user model
2015-05-19 17:57:27 +03:00
Tom Christie
ec8e7f27e7 Fixes for format preservation 2015-05-19 15:49:37 +01:00
Petros Moisiadis
bb002262ac Support basic authentication with custom user models that change username field
Support basic authentication with custom user models with a username field that is not named 'username'.
2015-05-19 17:42:44 +03: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
Omer Katz
67ff078388 Renamed the cached fields lists. 2015-05-17 09:54:33 +03:00
David Sanders
b7edd46313 Use simpler dict.get() rather than try/except 2015-05-16 01:01:27 +10:00
tony
0906bf2c08 fix empty and_query 2015-05-15 16:44:12 +03:00
tony
de95598a1e removed using view.model.objects 2015-05-15 13:46:56 +03:00
David Sanders
8e84a9f6d0 Allow invalid outputs to pass through to_representation() for ChoiceField & MultipleChoiceField 2015-05-15 18:59:10 +10:00
Tom Christie
b4d82a0f55 Preserve format query param 2015-05-15 09:18:45 +01:00
tony
c47ec60ea2 no need to do distinct on every loop cycle & add analogue of distinct for oracle users 2015-05-14 17:04:22 +03:00
tony
7813d2fb35 fix DISTINCT for Oracle databases 2015-05-14 13:57:36 +03:00
Xavier Ordoquy
1a8c0b4bfc Merge pull request #2930 from linovia/release/3.1.2
Release 3.1.2
2015-05-14 10:57:33 +02:00
Alex Rothberg
a804d0bd75 set the action when override_method regardless of its None-ness 2015-05-13 22:53:32 -04:00
Tom Christie
ea1145c5aa Merge pull request #2905 from ticosax/django-object-perm-get_queryset
Allow DjangoObjectPermissions to use views that define get_queryset
2015-05-13 13:39:59 +01:00
Nicolas Delaby
031ac2a292 Allow DjangoObjectPermissions to use views that define get_queryset 2015-05-13 14:26:44 +02:00
Xavier Ordoquy
fb4ba3ad3c Bump version to 3.1.2 2015-05-13 09:44:15 +02:00
Tom Christie
9424e59b9e Styling of nested lists/objects in detail view 2015-05-12 16:28:49 +01:00
Tom Christie
a1421cd4a3 Basic formatting for dict and list values 2015-05-12 16:18:45 +01:00
Tom Christie
9a504efd26 Basic formatting for admin cells 2015-05-12 15:21:49 +01:00
Tom Christie
995aa47570 First pass templates for admin style 2015-05-12 14:49:09 +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
Omer Katz
1ee3173583 Cache fields list for to_internal_value and to_representation. 2015-05-09 14:37:49 +03:00
Tom Christie
abcd6f2b9e Merge pull request #2869 from ryangallen/datefield
DateField to_representation can handle str and empty values. Fixes #2656, #2687.
2015-05-01 16:33:43 +01:00
Tom Christie
2eb9107b87 Merge pull request #2798 from Boomerangz/depth-should-reduce
Depth should reduce on nested ModelSerializer classes.
2015-04-27 16:22:22 +01:00
Tom Christie
2394577dc2 Merge pull request #2757 from ekiourk/2630/Raise-exception-when-ModelSerializer-used-with-abstract-model
Raise error when ModelSerializer used with abstract model
2015-04-27 14:47:32 +01:00
José Padilla
9809f4d36a Merge pull request #2809 from aparsons/master
Move ul.breadcrumb margin to bootstrap-tweaks.css
2015-04-26 11:15:50 -04:00
Tom Christie
450c541462 Merge pull request #2868 from ticosax/versioning-header-all
Check AcceptHeaderVersioning with content negotiation in place
2015-04-24 15:19:51 +01:00
Allard Hoeve
9a794beb1e Remove mention of Django's built-in ValidationError in docstring
The `exception_handler` does not actually handle django.core.exceptions.ValidationError, so remove any mention of it.

This closes #2872
2015-04-24 15:37:42 +02:00
Ryan Allen
cbea03c85b DateField to_representation can handle str and empty values. Fixes #2656, #2687. 2015-04-23 19:31:46 -05:00
Nicolas Delaby
63511c03d0 Check AcceptHeaderVersioning with content negotiation in place 2015-04-23 14:19:39 +02:00
Nicolas Delaby
24e9473036 Improve error message. 2015-04-22 11:22:37 +02:00
Nicolas Delaby
6f66798ad3 Prevent empty querysets to raises AssertionError. 2015-04-22 11:13:09 +02:00
Nicolas Delaby
c2e536bfda Tell DjangoModelPermissions to rely on get_queryset first. 2015-04-22 10:18:30 +02:00
Tom Christie
0ca1145456 Merge pull request #2853 from ryangallen/master
Set IntegerField class variable for compiled decimal regex, comment for ...
2015-04-21 16:00:37 +01:00
Ryan Allen
32acc4a72b Set IntegerField class variable for compiled decimal regex, comment for purpose 2015-04-21 10:52:52 -04:00
Tom Christie
605369e2b4 Merge pull request #2807 from iorlas/patch-2
Now it is possible to display viewset w/o paginator
2015-04-21 15:07:11 +01: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
Adam Parsons
72230a913e Removed color from default 2015-04-18 16:52:20 -05:00
Adam Parsons
324ccc3664 Moved breadcrumb color to bootstrap-tweaks
Moved to color associated with the breadcrumb to the tweaks style sheet.
2015-04-18 16:50:32 -05:00
Tymur Maryokhin
1ddfef1212 Removed deprecated '.model' attribute check 2015-04-12 17:12:01 +02: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
Adam Parsons
77460d4bca Moved ul.breadcrumb margin to bootstrap-tweaks.css
When importing other bootstrap themes from sites like bootswatch, the
margin in default.css persists and adds a 70px margin below the header.
This change will remove that margin when users choose to use a different
bootstrap theme.
2015-04-08 20:10:33 -05:00