Commit Graph

25 Commits

Author SHA1 Message Date
954
03c2ef1787
Fixes instance check in ListSerializer.to_representation (#8726) (#8727)
* Fixes 'RelatedManager' object is not iterable in ListSerializer.to_representation.(#8726)

* Change to only BaseManager

* Commit unit test

* Update tests/test_serializer_lists.py

* Update tests/test_serializer_lists.py

* Update tests/test_serializer_lists.py

* Update tests/test_serializer_lists.py

* Update tests/test_serializer_lists.py

* Update tests/test_serializer_lists.py

* Format import

* Format import

Co-authored-by: Asif Saif Uddin <auvipy@gmail.com>
2022-11-22 12:01:01 +06:00
itsdkey
e7af8d662b
tests for #5127 (#7715)
* tests for #5127

* Resolves #5127
2022-06-08 13:41:26 +01:00
Ryan P Kilby
f323049ecc
Fix pk-only optimization for properties (#7142)
* Add callable/prop tests for pk-only optimization

* Fix related field pk-only optimization for props
2020-09-03 11:49:15 +01:00
Jon Dufresne
3f19e66d9f Replace all usage ugettext functions with the non-u versions (#6634)
On Python 3, the ugettext functions are a simple aliases of their non-u
counterparts (the 'u' represents Python 2 unicode type). Starting with
Django 3.0, the u versions will be deprecated.

https://docs.djangoproject.com/en/dev/releases/3.0/#id2

> django.utils.translation.ugettext(), ugettext_lazy(), ugettext_noop(),
> ungettext(), and ungettext_lazy() are deprecated in favor of the
> functions that they’re aliases for:
> django.utils.translation.gettext(), gettext_lazy(), gettext_noop(),
> ngettext(), and ngettext_lazy().
2019-05-01 07:49:54 +02:00
Carlton Gibson
0407a0df8a
Dropped Python 2 compatibility. (#6615)
Thanks to Jon Dufresne (@jdufresne) for review.

Co-authored-by: Asif Saif Uddin <auvipy@gmail.com>
Co-authored-by: Rizwan Mansuri <Rizwan@webbyfox.com>
2019-04-30 17:53:44 +02:00
Carlton Gibson
8a29c53226 Allowed Q objects in limit_choices_to introspection. (#6472)
Closes #6470.
2019-02-25 10:49:29 +00:00
Adrien Brunet
e3bd4b9048 Fix #1811: take limit_choices_to into account with FK (#6371)
* Fix issue1811: take limit_choices_to into account with FK

* Issue 1811: Add tests to illustrate issue

* Filter queryset only if limit_choices_to exists

* Move test_relations_with_limited_querysets file within test_relations_pk

* move limit_choices_to logic from relations.py to utils/field_mapping.py

* move limit_choices_to above other check to avoid conflicts
2019-01-08 13:49:47 +00:00
Carlton Gibson
247cf096d4
Test using model objects for dotted source default (#5880)
… when path components may be null.

Ref #5375, #5727
2018-03-16 14:51:37 +01:00
Ryan P Kilby
f6c19e5eac Remove DjangoFilterBackend and associated tests 2017-09-20 16:47:54 +02:00
Matt Davis
6115815108 Special case for when OneToOneField is also primary key.
https://github.com/encode/django-rest-framework/issues/5135
2017-05-30 13:57:45 -04:00
Tom Christie
994e1ba927 Django 1.10 support. (#4158)
* Added TEMPLATES setting to tests
* Remove deprecated view-string in URL conf
* Replace 'urls = ...' in test classes with override_settings('ROOT_URLCONF=...')
* Refactor UsingURLPatterns to use override_settings(ROOT_URLCONF=...) style
* Get model managers and names in a version-compatible manner.
* Apply override_settings to a TestCase, not a mixin class
* Use '.callback' property instead of private attributes when inspecting urlpatterns
* Pass 'user' to template explicitly
* Correct sorting of import statements.
* Remove unused TEMPLATE_LOADERS setting, in favor of TEMPLATES.
* Remove code style issue
* BaseFilter test requires a concrete model
* Resolve tox.ini issues
* Resolve isort differences between local and tox environments
2016-06-01 15:31:00 +01:00
Asif Saifuddin Auvi
dc09eef24a Style fix of tests (#4154)
Clean up code style.
2016-06-01 10:40:54 +01:00
Carlton Gibson
20d1fdba69 Fix None UUID ForeignKey serialization 2016-02-16 09:29:48 +01:00
Mads Jensen
215e1b6c6b Regarding #3729
python -Werror generates warnings informing that on_delete is a required keyword in Django 2.0
2016-01-14 15:14:33 +01:00
José Padilla
83c9136c90 Cleanup import following PEP 8 style guide 2015-06-25 16:10:17 -04:00
Tymur Maryokhin
dd9d40d8c0 Moved non-conflicting models 2014-11-29 20:04:50 +01:00
Tymur Maryokhin
2f03483f96 Removed unused models 2014-11-29 19:45:26 +01:00
Tom Christie
5b7e4af0d6 get_base_field() refactor 2014-09-18 11:20:56 +01:00
Xavier Ordoquy
06b6b96f93 Remove duplicated model declaration. 2014-08-19 16:32:30 +02:00
Xavier Ordoquy
c9535c036b Merged #1398 against 2.4 branch. 2014-08-19 11:12:36 +02:00
Xavier Ordoquy
4876bec9f5 Merge remote-tracking branch 'origin/master' into 2.4.0
Conflicts:
	rest_framework/fields.py
2014-07-26 00:06:56 +02:00
Xavier Ordoquy
2489e38a06 Merge remote-tracking branch 'origin/master' into 2.4.0
Conflicts:
	.travis.yml
	docs/api-guide/viewsets.md
	rest_framework/serializers.py
	rest_framework/throttling.py
	tests/test_generics.py
	tests/test_serializers.py
	tox.ini
2014-06-23 14:02:45 +02:00
Xavier Ordoquy
2aca69a946 Merge remote-tracking branch 'reference/master' into feature/pytest
Conflicts:
	tests/test_serializer.py
2014-04-30 22:24:01 +02:00
Xavier Ordoquy
1797a74e82 Merge remote-tracking branch 'pelme/pytest' into feature/pytest
Conflicts:
	.travis.yml
	rest_framework/runtests/runtests.py
	tests/test_filters.py
	tests/test_pagination.py
	tox.ini
2014-04-17 09:53:44 +02:00
Andreas Pelme
971578ca34 Support for running the test suite with py.test
* Get rid of runtests.py
 * Moved test code  from rest_framework/tests and rest_framework/runtests to tests
 * Invoke py.test from setup.py
 * Invoke py.test from Travis
 * Invoke py.test from tox
 * Changed setUpClass to be just plain setUp in test_permissions.py
 * Updated contribution guideline to show how to invoke py.test
2014-03-02 12:40:30 +01:00