Commit Graph

2435 Commits

Author SHA1 Message Date
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
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
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
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
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
iorlas
548ac9a65e Now it is possible to display viewset w/o paginator
Since pagination is now included in every generic viewset, we should have ability to disable it and we have it: paginator=None or pagination_class=None. But this piece of code relies on existence of property instead of its value.
2015-04-08 20:32:02 +03:00
Igor Zygin
2d5b4f4cc9 Depth should reduce
Depth should reduce
2015-04-06 10:13:25 +06:00
José Padilla
2e6d39dbae Merge pull request #2754 from bleib1dj/enhancement_dont_require_pk_strictly_related
Enhancement dont require pk strictly related #2745
2015-04-04 22:01:06 -04: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
Udi Oron
b95ef25cbb Wrong error message on bad field lookup 2015-03-26 20:13:35 +02:00
José Padilla
55ee588f6e Use default reason phrases from HTTP standard.
Closes #2763
2015-03-25 13:27:47 -04:00
Ilias Kiourktsidis
0888f9cfc3 Use _meta instead of Meta on is_abstract_model function 2015-03-25 12:00:20 +00:00
Simon Charette
87208021e2 Metadata should detect null boolean field type. 2015-03-24 21:31:35 -04:00
Devon Bleibtrey
b1c1867b16 Swapping to hassattr logic for pk attribute references in relations 2015-03-23 11:40:33 -04:00
Ilias Kiourktsidis
486f0a9367 Raise error when ModelSerializer used with abstract model 2015-03-23 15:01:19 +00:00
Devon Bleibtrey
7ac3c3fff7 Added enhancement for pk reference in many=True relations 2015-03-23 10:42:42 -04:00
Tom Christie
a90dbe3bd9 Merge pull request #2724 from delinhabit/namespaced-versioning-non-api-reversal
Handle reversal of non-API view_name in HyperLinkedRelatedField
2015-03-23 11:35:21 +00:00
Tom Christie
f7cd7a1c1f Latest translation strings 2015-03-23 11:32:28 +00:00
Tom Christie
e73ddddc3a Merge pull request #2726 from linovia/release/3.1.1
Release notes for 3.1.1 and version bump.
2015-03-23 11:20:23 +00:00
Tom Christie
7872d0acbf Escape tab switching cookie 2015-03-23 11:20:09 +00:00
Tom Christie
166801063d Merge pull request #2743 from maurodoglio/serializer_class-html-renderer
Use `serializer_class` for browsable API display, even on plain APIView.
2015-03-23 09:43:39 +00:00
Devon Bleibtrey
8a58b1a380 Added ability to define backend identification attribute 2015-03-22 13:50:05 -04:00
mdoglio
77c44d8c63 Make BrowsableAPIRenderer use serializer_class when present 2015-03-22 14:36:30 +00:00
mdoglio
d0126b7e31 Set serializer_class on ObtainAuthToken view 2015-03-22 12:35:56 +00:00
mdoglio
fde02ae6eb AuthTokenSerializer - properly render password field 2015-03-22 12:13:28 +00:00
Ion Scerbatiuc
fac2785341 Handling the fallback in reverse 2015-03-19 16:12:28 -07:00
Xavier Ordoquy
164be174ea Release notes for 3.1.1 and version bump. 2015-03-19 23:29:10 +01:00
Ion Scerbatiuc
90280a3437 Handle reversal of non-API view_name in HyperLinkedRelatedField 2015-03-19 14:16:45 -07:00
Di Wu
48e1f151c5 use SAFE_METHODS and make tuple 2015-03-16 22:13:07 -07:00
Tom Christie
2148f32007 Merge pull request #2700 from tomchristie/do-not-paginate-if-page-size-none
Do not paginate if PAGE_SIZE=None
2015-03-16 12:15:50 +00:00
Tom Christie
992971d648 Merge pull request #2631 from Ins1ne/feature/issue-2559
Allow blank/null on radio.html choices
2015-03-16 12:11:33 +00:00
Tom Christie
5cd0714dca Do not paginate if PAGE_SIZE=None 2015-03-16 12:05:31 +00:00
Tom Christie
4cd49d5de3 Merge branch 'master' of https://github.com/tomchristie/django-rest-framework 2015-03-16 11:57:42 +00:00
Tom Christie
c573e7b4a8 Latest translation strings 2015-03-16 11:57:28 +00:00
Ion Scerbatiuc
022c4d540b Refactored DecimalField to allow easier subclassing 2015-03-14 07:16:17 -07:00
mochawich
2266fec99d fixed missing anchor closing tag
when next_url is none, big part of page html will be rendered under the <a href='#'> as it does not have a closing tag.
2015-03-13 17:03:51 +01:00
Raphaël Barrois
8d0dbc8092 Fix lookup_url_kwarg handling in viewsets.
The ``lookup_url_kwarg`` is intended to set the name of a field in the
URL regexps when using custom ``lookup_field``, but the routers ignore
it altogether.
2015-03-13 01:07:20 +01:00
Dirk Moors
6c1d0d7ed0 Fixed problem with imporing rest_framework.views in apps.py 2015-03-12 16:36:26 +01:00
Carlton Gibson
53e1a2fcb9 Merge pull request #2637 from mdentremont/topic/allow-serialize-unsaved-with-relations
Support serializing unsaved models with related fields.
2015-03-08 20:22:49 +01:00
Aider Ibragimov
7159b31023 update vertical and inline layouts for radio choices 2015-03-07 07:17:22 +03:00
José Padilla
0e21f1c4f4 Merge pull request #2640 from Crystalnix/fix-remove-mergedict
Remove `MergeDict`
2015-03-06 19:17:58 -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
58dfde7fcd Tweaks for cursor pagination and docs 2015-03-06 10:22:32 +00:00
Egor Yurtaev
ce31e36973 Remove MergeDict
The class MergeDict is deprecated and will be removed in Django 1.9
2015-03-05 18:34:42 +06:00
Tom Christie
f7917928c0 Merge branch 'master' of https://github.com/tomchristie/django-rest-framework 2015-03-04 16:17:44 +00:00
Tom Christie
18cc0230bf Clean up pagination attributes 2015-03-04 15:51:00 +00:00
Aider Ibragimov
c44376c613 remove unnecessary check 2015-03-04 14:17:58 +03:00
Aider Ibragimov
fdd811ec53 Allow blank/null on radio.html choices 2015-03-04 08:22:46 +03:00
Tymur Maryokhin
391b0ae21b Call default.set_context() only on create. Refs #2619. 2015-03-03 17:02:12 +01: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
313b3d7c3b Update ModelSerializer mappings 2015-02-28 10:18:47 +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
Ian Foote
32c885c2a0 Ensure validators are new-style classes on python2 2015-02-27 15:22:19 +00: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
Tom Christie
c66f23391a Merge pull request #2572 from Ins1ne/master
Fix UniqueTogetherValidator for NULL values
2015-02-26 15:56:18 +00:00
Tom Christie
d219fc0d81 Merge pull request #2602 from dbrgn/fix-1602
List resource not updated between requests
2015-02-26 15:52:54 +00:00
Tom Christie
88cd86c956 Merge pull request #2587 from jpadilla/select-multiple-disabled
Disable select field if no choices available
2015-02-26 12:54:58 +00:00
Tom Christie
03818ed004 Pagination tweaks and docs 2015-02-26 12:48:34 +00:00
Danilo Bargen
86c5fa2401 Force-evaluate querysets (see #2602) 2015-02-25 18:54:47 +01:00
Yannick PEROUX
940cf2e2e0 Remove duplicated code in routers.SimpleRouter 2015-02-25 13:29:07 +01:00
Yannick PEROUX
bdc64d4e73 Fix removal of url_path on @detail_route and @list_route. Fix # #2583
SimpleRouter.get_routes was popping out the url_path kwarg from
list_route and detail_route decorators. This was causing troubles
when the route was re-used, for example if the viewset was
inherited.
2015-02-25 11:54:11 +01:00
Tom Christie
b69032f3a7 Merge pull request #2586 from rense/master
Set field max_length/max_value as actual attribute.
2015-02-21 15:31:02 +00:00
Rense VanderHoek
91416632a8 DecimalField fix
max_value and min_value are not in kwargs
2015-02-21 12:31:37 +01:00
Tymur Maryokhin
7345830c88 Check if sessions are enabled before calling logout. Closes #2545. 2015-02-20 20:12:39 +01:00
Rense VanderHoek
9cb547b85f Validator-fix, added min/max fields to test_metadata 2015-02-20 17:34:49 +01:00
José Padilla
bb8690cfb3 Disable select field if no choices available 2015-02-20 11:43:12 -04: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
Rubén Durá Tarí
60617f876a Fixes HiddenField being rendered in HTMLFormRenderer 2015-02-20 07:50:15 -04:00
Aider Ibragimov
fe8d95f93e Skip validation of NULL field only if it part of unique_together 2015-02-19 18:03:44 +03:00
Aider Ibragimov
3d85473edf Fix UniqueTogetherValidator for NULL values 2015-02-18 21:00:12 +03:00
Tom Christie
e45e0f0567 Update version 2015-02-17 13:44:42 +00:00
José Padilla
85bf127943 Merge pull request #2567 from carltongibson/18-warning
Move `importlib` fallback into compat.
2015-02-17 08:39:06 -04:00
Tom Christie
dbd2352165 Fixes for latest pep8 updates. Refs #2563. 2015-02-17 10:58:00 +00:00
Carlton Gibson
c5eb5b2201 Move importlib fallback into compat. 2015-02-17 11:55:15 +01:00
Carlton Gibson
daf1d59d0f Adjust importlib import 2015-02-17 11:22:37 +01:00
Tom Christie
4248a8d3fc Merge pull request #2198 from tomchristie/version-3.1
Version 3.1
2015-02-13 13:38:44 +00:00
Tom Christie
c3425accde Fix incorrect HTML parsing for DictField 2015-02-11 14:19:07 +00:00
donewell
9a9a00bff2 simplify argument handling 2015-02-11 11:15:01 +00:00
Xavier Ordoquy
637af1fc14 Merge pull request #2540 from linovia/release/3.0.5
Release/3.0.5
2015-02-10 23:48:38 +01:00
Xavier Ordoquy
59b3fe8f39 Bumped the version to 3.0.5 2015-02-10 22:48:04 +01:00
donewell
9ea615af14 add message to custom permission
change detail to message and update text
2015-02-10 20:11:53 +00:00
Carlton Gibson
3522b69394 Add distinct call in filter_queryset 2015-02-10 10:51:38 +01:00
Tom Christie
fbb21caaaa Merge master 2015-02-09 20:43:50 +00:00
Tom Christie
b2939c157d Fixes for latest version of pep8 2015-02-09 17:43:20 +00:00
Tom Christie
54d82f59ed Py3 compat fix 2015-02-09 17:19:22 +00:00
Tom Christie
d13c807616 Fix misleading AttributeErrors 2015-02-09 17:02:54 +00:00
Tom Christie
0240df1a38 Minor internal API cleanpu 2015-02-06 16:15:10 +00:00
Tom Christie
670723f021 Minor cleanups/improvements to ModelSerializer API 2015-02-06 15:45:02 +00:00
Tom Christie
dec3493d7c Minor cleanup 2015-02-06 14:43:43 +00:00
Tom Christie
a435b1b355 Merge branch 'version-3.1' of git://github.com/jpadilla/django-rest-framework into version-3.1 2015-02-06 14:39:31 +00:00
Tom Christie
1f99612845 Upgrade pending deprecations to deprecations 2015-02-06 13:21:35 +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
Kaptian
fffde8a63b Update throttling.py
Use pk pseudo attribute for identifying the user (in case the user model is not the default and has a different column name for the unique id)
2015-02-05 13:27:26 -08:00
José Padilla
c696b0ba0c Fix possible nested array fields 2015-02-05 10:12:14 -04:00
José Padilla
720d154c83 Merge remote-tracking branch 'upstream/version-3.1' into version-3.1 2015-02-04 23:34:20 -04:00
José Padilla
48fa77c09e Add child to ListField when using ArrayField 2015-02-04 23:33:59 -04:00
Tom Christie
e1c4513312 Fix NamespaceVersioning with hyperlinked serializer fields 2015-02-05 00:58:09 +00:00
Tom Christie
83673e8f74 Merge branch 'version-3.1-2489' of git://github.com/brandoncazander/django-rest-framework into brandoncazander-version-3.1-2489 2015-02-04 23:32:48 +00:00
Tom Christie
3b00824560 Merge pull request #2518 from longhotsummer/patch-1
FIX: Don't default to list in method args
2015-02-04 14:30:53 +00:00