Commit Graph

8430 Commits

Author SHA1 Message Date
Mariusz Felisiak
bc075212cb
Fix running runtests.py without arguments. (#7954)
Regression in aa12a5f967.
2021-05-24 09:47:44 +02:00
Ishu Kumar
3875d3284e
Punctuations and missing "to" preposition (#7966)
Changes made in lines 221, 222, 223, and 224 for better readability.
2021-05-10 12:26:26 +01:00
Julien Palard
a0083f7f98
FIX: Broken cite. (#7951) 2021-04-26 09:30:41 +01:00
Łukasz Skarżyński
431f7dfa3d
fix typo in packaging requirements (#7949) 2021-04-23 09:34:58 +01:00
Denis Orehovsky
8812394ed8
Add distinction between request and response serializers for OpenAPI (#7424)
* Add distinction between request and response serializers

* Add docs

* document new functions in schemas.md

* add a test case for different request vs response objects

* Correct formatting for flake8

Co-authored-by: Shaun Gosse <shaun.gosse@emburse.com>
2021-04-20 15:03:16 +01:00
Adam Johnson
010c8d4f08
Use tox-py in CI (#7925) 2021-04-16 17:59:27 +01:00
Adam Johnson
67b5093ca5
Fix pytest warnings (#7928)
* Use `--strict-markers` instead of `--strict`, as per this warning:

  ```
  /.../_pytest/config/__init__.py:1183: PytestDeprecationWarning: The --strict option is deprecated, use --strict-markers instead.
  ```

* Remove config option 'testspath' - pytest is logging a warning about this being unknown:

  ```
  /.../_pytest/config/__init__.py:1233: PytestConfigWarning: Unknown config option: testspath
  ```

  I can't find any reference to it in the pytest docs or changelog.
2021-04-16 17:47:21 +01:00
Terence Honles
a0a2c5cb37
Fix tests with mock timezone (#7911)
After django/django#13877, Django no longer checks for `hasattr(timezone, 'localize')` and instead does an inheritance check.
2021-04-16 17:27:22 +01:00
Adam Johnson
f628db383a
Fix GitHub Actions to run on 'master' branch (#7926)
The config I copied in #7903 was from a repo with the new name 'main', so tests have not been running on master since.
2021-04-16 17:23:18 +01:00
Terence Honles
1c494e3d94
Update references to Travis CI after moving to Github Actions (#7909)
x-ref: https://github.com/encode/django-rest-framework/pull/7903
2021-04-12 13:14:26 +01:00
Lalit Suthar
9bdd6125a1
fix broken article link (#7918)
Co-authored-by: lalit97 <lalit.suthar@redhuntlabs.com>
2021-04-12 11:59:58 +01:00
Adam Johnson
fd017d00f9
Move CI to GitHub Actions (#7903)
* Recreate all the jobs on GitHub Actions
* Upgrade to Ubuntu 20.04
* Upgrade base/docs/dist to Python 3.9
2021-04-06 18:34:18 +01:00
Adam Johnson
90635c138f
Update pre-commit for flake8 move (#7907)
See: https://twitter.com/codewithanthony/status/1378746934928699396
2021-04-06 17:49:17 +01:00
Adam Johnson
37ef62b0e6
Remove link to third party cookiecutter template (#7902)
The template has not been maintained for six years, so it's out of date on versions and various "best practices" (e.g. pre-commit). I also think any template should be documented on its own repo rather than here, especially if it's not an official maintained project.
2021-04-05 18:18:35 +01:00
Adam Johnson
aa12a5f967
Lint with pre-commit (#7900)
Following [my comment here](https://github.com/encode/django-rest-framework/pull/7589#issuecomment-813301322) and [Django's own move to pre-commit](https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/coding-style/#pre-commit-checks).

* Add pre-commit config file to run flake8 and isort.
* Add extra "common sense" hooks.
* Run pre-commit on GitHub actions using the [official action](https://github.com/pre-commit/action/). This is a good way to get up-and-running but it would be better if we activated [pre-commit.ci](https://pre-commit.ci/), which is faster and will auto-update the hooks for us going forwards.
* Remove `runtests.py` code for running linting tools.
* Remove `runtests.py --fast` flag, since that would now just run `pytest -q`, which can be done with `runtests.py -q` instead.
* Remove tox configuration and requirements files for linting.
* Update the contributing guide to mention setting up pre-commit.
2021-04-05 12:08:52 +01:00
Adam Johnson
846fe70cff
De-duplicate contributing guide (#7901)
The contributing guide from `docs/community/contributing.md` was copy-pasted to `CONTRIBUTING.md` and the two have drifted apart over time. The docs page seems to have been updated a bit more so let's leave only that version.
2021-04-05 11:12:28 +01:00
David Smith
d82519bf8a
Updated dependencies (#7589) 2021-04-05 10:28:03 +01:00
dependabot[bot]
78da1a824f
Bump pygments from 2.4.2 to 2.7.4 in /requirements (#7886)
Bumps [pygments](https://github.com/pygments/pygments) from 2.4.2 to 2.7.4.
- [Release notes](https://github.com/pygments/pygments/releases)
- [Changelog](https://github.com/pygments/pygments/blob/master/CHANGES)
- [Commits](https://github.com/pygments/pygments/compare/2.4.2...2.7.4)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-01 16:52:19 +01:00
Tom Christie
406e6a2f35
Update MANIFEST.in (#7893) 2021-04-01 14:15:53 +01:00
David Smith
96885dd9a7
Fixed markdown test (#7892)
The pygments rendering of invalid json changed in  pygments>=2.7.3
2021-04-01 09:49:47 +01:00
Tom Christie
0323d6f895
Linting fixes (#7874)
* Fixed code quality issues

- Added '.deepsource.toml' file for continuous analysis on bug risk

- Remove `return` from `__init__()` method

- Remove duplicate dictionary key(s)

- Use `max` built-in to get the maximum of two values

- Remove redundant `None` default

- Remove unnecessary comprehension

Signed-off-by: ankitdobhal <dobhal.ankit@protonmail.com>

* Delete .deepsource.toml

* Delete test_fields.py

* Reintroduce file from accidental deletion

Co-authored-by: ankitdobhal <dobhal.ankit@protonmail.com>
2021-03-26 12:27:10 +00:00
Tom Christie
f83620dcc9
Version 3.12.4 (#7873)
* Version 3.12.4

* Tweak release notes
2021-03-26 09:27:01 +00:00
Tom Christie
72c155d8f4
Revert "pick deque instead of list (#7849)" (#7872)
This reverts commit ebcb8d5310.
2021-03-26 09:17:47 +00:00
Tom Christie
dffa612134
Fix release notes typo 2021-03-25 12:30:45 +00:00
Tom Christie
83ad265e13
Version 3.12.3 (#7866) 2021-03-25 12:23:23 +00:00
Jack
ebcb8d5310
pick deque instead of list (#7849)
Co-authored-by: Jack Zhang <jack.zhang@aspiraconnect.com>
2021-03-25 10:47:44 +00:00
Joe Michelini
71e6c30034
update SerializerMethodField example in docs (#7858)
* update SerializerMethodField example

* fix formatting
2021-03-22 12:08:19 +00:00
Mohammad Ashraful Islam
7e3dd9cd1b
Added fast-drf as a thirdparty package for making API development faster. (#7857) 2021-03-22 12:07:48 +00:00
Hasan Talha Yazıcı
0cddf097ca
Fix typo in docs (#7853) 2021-03-21 09:53:09 +00:00
Anton Zaslavskiy
b25ac6c5e3
Don't hit db to access user_id in TokenProxy (#7852) 2021-03-19 11:46:09 +00:00
Aristotelis Mikropoulos
67ebdd32cd
Reject PrimaryKeyRelatedField bool lookup values (#7597)
* Reject PrimaryKeyRelatedField bool lookup values

* Test PrimaryKeyRelatedField bool lookup rejection

* Fix indentation in test
2021-03-17 13:28:38 +00:00
Tom Christie
7b53960c3b
Revert "made Browsable API base template cachable: omit CSRF token when unnecessary (#7717)" (#7847)
This reverts commit 9c9ffb18f4.
2021-03-17 13:24:55 +00:00
Tom Christie
3e274146fc
Fix WSGI signature for DjangoTestAdapter (#7846)
Closes https://github.com/encode/django-rest-framework/issues/7132
2021-03-17 13:24:38 +00:00
Yuekui
a40bce50cd
No need to explictitly set None as default (#7373) 2021-03-16 13:29:13 +00:00
Jesse London
9c9ffb18f4
made Browsable API base template cachable: omit CSRF token when unnecessary (#7717)
HTML responses generated by the Browsable API otherwise generate
inconsistent ETAGs -- due to the presence of CSRF tokens in the response
-- even when the API is read-only, (and as such when the response
contains no resource-modifying forms, i.e. neither POST nor PUT forms,
which might require the CSRF token).

While the template was appropriately including CSRF tokens only within
POST and PUT forms, its AJAX overlay included the CSRF token in *every*
response, regardless of whether it would be needed.

This change brings the logic of the `script` block into line with that
of the rest of the template -- and such that read-only APIs (and really
the Browsable API pages of *any* read-only resources) will not
needlessly include the CSRF token, and will now be safely cachable -- by
both back-end systems and by the user agent.
2021-03-16 13:25:21 +00:00
Jeff Baumes
b0ca248d88
Correct the use of "to" (#7696) 2021-03-16 12:57:04 +00:00
Ömer Faruk Abacı
ce1568322a
Ordering filter bug with model property serializer field (#7609)
* Add failing tests for ordering filter with model property

* Fix get_default_valid_fields of OrderingFilter

* Filter model properties in get_default_valid_fields of OrderingFilter
2021-03-16 12:53:39 +00:00
Alex Hedlund
b256c46cb1
Render JSON fields with proper indentation in browsable API forms. (#6243)
* Fix JSONBoundField usage on nested serializers (#6211)

* Unify JSONBoundField as_form_field output between py2 and py3

When using json.dumps with indenting, in python2 the default formatting
prints whitespace after commas (,) and python3 does not. This can be
unified with the separators keyword argument.
2021-03-15 10:44:03 +00:00
Henryk Plötz
ff625ecff5
Document object level permissions gotchas (#7446)
* Document the limitation that object level permissions do not apply to object creation. See for example #6409.

* Add overview of three different ways to restrict access
2021-03-15 10:28:45 +00:00
Ömer Faruk Abacı
883f6fe814
Rename django-extra-fields to drf-extra-fields (#7833) 2021-03-11 11:39:06 +00:00
Carlton Gibson
f070619061
Updated tox/travis to point to Django main branch. (#7827) 2021-03-11 10:26:11 +00:00
Tom Christie
39a98c80a6 Fix 'get_page_number' implementation 2021-03-11 09:21:22 +00:00
Tom Christie
c05cbe2da2
Update pagination.py
Include `last_page_strings` logic *inside* the `get_page_number method.
2021-03-10 12:50:59 +00:00
Max Morlocke
ffe11d41bd
upgrade pytest+pytest-django to eliminate dependencies on six (#7672)
* upgrade to latest version of pytest+pytest-django to eliminate dependency on six

* rollback pytest to 6.1 as py35 is dropped in 6.2

Co-authored-by: Tom Christie <tom@tomchristie.com>
2021-03-10 12:45:47 +00:00
Feanil Patel
c78f992176
Make the doc on overriding the default permission classes more clear. (#7661) 2021-03-10 12:44:17 +00:00
Eshaan Bansal
4f3cd8c7b0
add django-rest-durin to 3rd party auth libs [docs] (#7615)
Co-authored-by: Tom Christie <tom@tomchristie.com>
2021-03-10 12:40:45 +00:00
John Alexis Munera
cef74d1726
Add rest-framework-actions to Third Party Packages (#7688)
This pull request adds rest-framework-actions to Third Party Packages, under Views

rest-framework-actions can be found on PyPi here: https://pypi.org/project/rest-framework-actions/

Co-authored-by: Tom Christie <tom@tomchristie.com>
2021-03-10 12:37:06 +00:00
sarath ak
6f6d402d04
Allow 'get_page' method for overriding #7626 (#7652) 2021-03-10 12:32:10 +00:00
Pierre Chiquet
c603b98403
Fix OpenAPISchema rendering for timedelta (#7641)
* Add failing test when rendering to json a schema with timedelta

* Fix JSONOpenAPIRenderer for fields with default=timedelta()

* fix isort

* fix test for python 3.5

Co-authored-by: Pierre Chiquet <pierre.chiquet@ubikey.fr>
2021-03-10 12:03:15 +00:00
PaulGilmartin
c69e2e4eaa
Add graphwrap to third-party-packages.md (#7819)
* Add graphwrap to third-party-packages documentation

* Fix typo in third party packages docs

* Remove additional newline

Co-authored-by: Paul Gilmartin <paulgilmartin@Pauls-MacBook-Pro.local>
Co-authored-by: Tom Christie <tom@tomchristie.com>
2021-03-10 09:02:38 +00:00