Tom Christie
bdeb28944f
Use RuntimeError, not AssertionError when guarding against direct View.queryset evalutation. Refs #3180 .
2015-07-24 09:13:39 +01:00
Tom Christie
e05021c8c6
Guard against erronous direct .queryset evaluation in CBVs.
2015-07-23 17:17:18 +01:00
Tom Christie
d14bc3c4e1
Fix test cases for python3
2015-07-23 14:41:28 +01:00
Tom Christie
90fe0fb881
Errors in browsable API on error. Closes #3024 .
2015-07-23 14:31:25 +01:00
Tom Christie
22631c73a7
Resolve assertion error with LimitOffsetPagination and erronous parameters. Closes #2920 .
2015-07-23 12:41:35 +01:00
Aider Ibragimov
d845157983
Merge branch 'master' of https://github.com/tomchristie/django-rest-framework into feature/filepathfield
2015-07-18 23:34:07 +03:00
Tom Christie
7b21336872
Rename model to play nice with Django 1.7.
2015-07-16 16:18:14 +01:00
Tom Christie
0b6eb4a881
Fix for Django 1.7 issue with long default verbose_name arguments on ChoiceField
2015-07-16 16:01:50 +01:00
Tom Christie
0ccb148183
Support QueryDict list arguments with ListField. Closes #3155 .
2015-07-16 15:59:15 +01:00
Tom Christie
e14391e041
Fix for ModelSerializer ChoiceField with nonstandard args. Closes #3126 .
2015-07-16 15:46:27 +01:00
Tom Christie
713333d354
Merge branch 'master' of github.com:tomchristie/django-rest-framework
2015-07-16 15:17:27 +01:00
Tom Christie
806b0b34da
Include nested objects in metadata for OPTIONS. Closes #3156 . Closes #2915 .
2015-07-16 15:17:18 +01:00
Tom Christie
264d423493
Added allow_empty flag for ListField, ListSerializer, ManyRelation, MultipleChoiceField.
2015-07-16 13:51:15 +01:00
Venelin Stoykov
73c0ebc2d5
Test for #3153
2015-07-16 15:40:41 +03:00
Tom Christie
cde7154c59
Runtests should not suppress stdout. In the context of a web app only serves to hide erronous print statements.
2015-07-16 11:50:22 +01:00
Tom Christie
d231f36588
Support default values being used for empty HTML fields. Closes #3130 .
2015-07-16 11:47:40 +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
Juan Gutierrez
2887fc4a0b
update QueryDict initialization to satisfy older versions of Django
2015-07-08 08:25:12 -04:00
Juan Gutierrez
35db2b142f
remove FakeMultiDict definition in nested serializer tests and replace with django QueryDict
2015-07-08 08:19:42 -04: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
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
fb4233736f
Empty settings should also be coerced to lists. Closes #3087 .
2015-07-02 10:28:46 +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
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
José Padilla
d6e30c75ff
Add test and fix for #2704
2015-06-25 09:35:36 -04: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
homm
9bc0319ff4
Revert tests
2015-06-23 19:02:05 +03:00
homm
b01e91eb71
test custom cursor format
2015-06-23 18:09:17 +03:00
homm
b3716ccb91
make MockObject, MockQuerySet and ExamplePagination visible outside of setup
2015-06-23 18:07:32 +03: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
aa1ad4fb64
test_requests TestSecure: skip tests for django versions where the secure
...
argument is not available
2015-06-22 14:28:09 +02:00
Markus Korn
d86e494e86
test_quests: added TestSecure for the emulation of secure connections in test cases
2015-06-22 14:04:46 +02: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
Brian Grohe
79736e516a
Added failing test case
...
Adding failing test case when many=false is explicitly defined
https://github.com/tomchristie/django-rest-framework/issues/3042
2015-06-17 13:18:50 -04: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
bfd7219352
Define the urlpatterns
as a list of `url()....
2015-06-11 01:01:47 +02:00
Xavier Ordoquy
9f1805f2f0
Removed unused imports.
2015-06-11 00:51:33 +02: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
fb2c09f6ae
Remove unused patterns import.
2015-06-11 00:36:37 +02:00
Xavier Ordoquy
e7e5946c2e
format_suffix_patterns
is applied before the trailing slash.
2015-06-11 00:32:05 +02:00
hellysmile
cbfce93129
Fitx TestCase due Django interals.
2015-06-08 18:15:31 +03:00
hellysmile
b015ae99e6
Inline @transaction.non_atomic_requests for Django<1.6.
2015-06-08 07:39:08 +03: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
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
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
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
Jannon Frank
a97c989248
fix read_only related field metadata
2015-06-02 00:40:00 -07:00
Nicolas Delaby
34dc98e8ad
improve wording
2015-06-02 09:19:58 +02:00
Nicolas Delaby
8ad38208a1
more assertions make the test more readable
2015-06-02 09:19:58 +02:00
Nicolas Delaby
d1371cc949
Use post instead of get for sanity of use-case.
2015-06-02 09:19:58 +02: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
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
94e2d3ca61
Test case upgrade to use partial data
2015-06-01 16:13:12 +01:00
Xavier Ordoquy
989c08109b
Failing test case for #2894
2015-06-01 16:04:05 +01:00
Tom Christie
0fdaa0dbba
Merge pull request #2992 from linovia/feature/clean_mock_html_dir
...
Remove an extra MockHTMLDict definition.
2015-06-01 15:54:09 +01:00
Xavier Ordoquy
2f524ec1a3
Remove an extra MockHTMLDict definition.
2015-06-01 15:46:27 +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
S. Andrew Sheppard
4a3c844b7f
flake8
2015-05-28 08:29:15 -05:00
S. Andrew Sheppard
0b8b288be5
python2 compat
2015-05-28 08:20:43 -05:00
S. Andrew Sheppard
805a915e7c
can't nest unique_together relations
2015-05-27 21:06:57 -05: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
8e84a9f6d0
Allow invalid outputs to pass through to_representation() for ChoiceField & MultipleChoiceField
2015-05-15 18:59:10 +10: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
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
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
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
6f66798ad3
Prevent empty queryset
s 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
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
Simon Charette
87208021e2
Metadata should detect null boolean field type.
2015-03-24 21:31:35 -04:00
Ilias Kiourktsidis
486f0a9367
Raise error when ModelSerializer used with abstract model
2015-03-23 15:01:19 +00:00
Andrea Grandi
a0049dd489
Add a blank line to make lint happier
2015-03-22 23:21:09 +00:00
Andrea Grandi
1d883e0825
Add two more tests for IPAddressField, checking the IPv4 and IPv6 protocols separately
2015-03-22 16:46:16 +00:00
Ion Scerbatiuc
fac2785341
Handling the fallback in reverse
2015-03-19 16:12:28 -07:00
Ion Scerbatiuc
90280a3437
Handle reversal of non-API view_name in HyperLinkedRelatedField
2015-03-19 14:16:45 -07:00
José Padilla
76ede5beda
Simplify test settings
2015-03-14 15:57:22 -04: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
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
18cc0230bf
Clean up pagination attributes
2015-03-04 15:51:00 +00: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
Kevin Wood
b582d52afb
Fix docstring formatting
2015-02-28 13:06:47 -08: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
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
16ffe5e31f
Add tests for callable attributes raising exceptions
2015-02-26 09:05:37 -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
1b398a20de
Who care what we do when it's totally malformed? Not me.
2015-02-26 13:41:25 +00:00
Tom Christie
4b745eef3a
Update test for more graceful 1.8 handling of malformed filename encodings
2015-02-26 13:25:14 +00:00
Yannick PEROUX
9cafdd1854
Add a test for #2583 fix
2015-02-25 11:54:56 +01:00
Rense VanderHoek
9cb547b85f
Validator-fix, added min/max fields to test_metadata
2015-02-20 17:34:49 +01:00
José Padilla
777f4e8212
Failing test for #2552
2015-02-19 12:23:44 -04:00
Aider Ibragimov
aa7ed316d8
Return UniquenessTogetherModel to previous state
2015-02-19 18:09:04 +03: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
4248a8d3fc
Merge pull request #2198 from tomchristie/version-3.1
...
Version 3.1
2015-02-13 13:38:44 +00:00
donewell
3d25dadbf3
change custom message for clarity
2015-02-11 11:20:03 +00: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
d87bb67d11
Failing test case for #1488
2015-02-10 10:50:35 +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
0669f507b3
pep8 fix
2015-02-09 17:22:13 +00:00
Tom Christie
54d82f59ed
Py3 compat fix
2015-02-09 17:19:22 +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
f98f842827
Minor bits of test cleanup
2015-02-05 01:24:55 +00:00
Tom Christie
e1c4513312
Fix NamespaceVersioning with hyperlinked serializer fields
2015-02-05 00:58:09 +00:00
Ofir Ovadia
58e7bbc8ec
Prefetching the user object when getting the token in TokenAuthentication.
...
Since the user object is fetched 4 lines after getting Token from the database, this removes a DB query for each token-authenticated request.
2015-02-04 16:08:41 +02:00
Brandon Cazander
030f01afdb
Reorganize tests.
2015-02-03 02:14:38 -08:00
Brandon Cazander
f3067a7fab
Remove unnecessary APIRequestFactory get from tests.
2015-02-02 20:41:06 -08:00
Brandon Cazander
77d061d234
Provide rest_framework.resolve. Fixes #2489
2015-02-02 20:37:33 -08:00
Tom Christie
2cc4cb2465
Fix error text in test.
2015-01-31 08:53:40 +00:00
Tom Christie
4ee4b4f2dc
Merge master
2015-01-30 14:00:25 +00:00
Tymur Maryokhin
ba7dca893c
Removed router check for deprecated '.model' attribute
2015-01-29 17:28:03 +01:00
Tom Christie
6d89430dd2
Merge pull request #2475 from sdreher/master
...
ManyRelatedField.get_value clearing field on partial update
2015-01-28 09:26:49 +00:00
Brandon Cazander
ac87490b91
Clone the versioning_scheme when necessary. Fixes #2477
2015-01-27 17:10:17 -08:00
Susan Dreher
e7da266a86
reorganize imports
2015-01-27 16:32:15 -05:00
Susan Dreher
1714ceae9f
reorganize imports
2015-01-27 16:31:25 -05: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
65bca59ea5
Reload api_settings when using Django's 'override_settings'
2015-01-27 13:51:30 +00:00
Brandon Cazander
6c083b12a1
Streamline test for #2455
2015-01-24 11:00:36 -08:00
Brandon Cazander
0ee2edc0a1
Add missed files for test.
2015-01-24 01:44:09 -08:00
Brandon Cazander
b09ef28959
Add failing test for request.version AttributeError in BrowsableAPI.
2015-01-24 01:37:23 -08: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
39f26c9eca
Merge master
2015-01-23 14:28:59 +00:00
Tom Christie
f3b6eedb8a
More sensible response caching.
2015-01-23 12:56:55 +00:00
Tom Christie
f1ac9d3f9b
More graceful handling of malformed Content-Disposition
2015-01-23 12:26:44 +00:00
Tom Christie
4cb164b66c
Add missing skipUnless(django_filters)
2015-01-23 11:49:57 +00:00
Tom Christie
e988d57853
Fix template loader monkey patching to also support 1.8
2015-01-23 11:47:01 +00:00
Tom Christie
43d983fae8
Add paging controls
2015-01-22 17:25:12 +00:00
Tom Christie
0822c9e558
Cursor pagination now works with OrderingFilter
2015-01-22 16:12:05 +00:00
Tom Christie
408261ee02
Support ordering attribute either on view or on pagination class for CursorPagination
2015-01-22 15:15:52 +00:00
Tom Christie
83a82b44a5
Support for tuple ordering in cursor pagination
2015-01-22 15:07:01 +00:00
Tom Christie
94b5f7a86e
Tidy up cursor tests and make more comprehensive
2015-01-22 12:14:52 +00:00