Skip to content

Commit

Permalink
Fix: Tests with python 3.11
Browse files Browse the repository at this point in the history
  • Loading branch information
onegreyonewhite committed Feb 11, 2023
1 parent 7df4341 commit 25b7ca7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Compatible with

- **Django Rest Framework**: 3.10, 3.11, 3.12, 3.13, 3.14
- **Django**: 2.2, 3.0, 3.1, 3.2, 4.0, 4.1
- **Python**: 3.6, 3.7, 3.8, 3.9, 3.10
- **Python**: 3.6, 3.7, 3.8, 3.9, 3.10, 3.11

Only the latest patch version of each ``major.minor`` series of Python, Django and Django REST Framework is supported.

Expand Down Expand Up @@ -362,23 +362,23 @@ provided out of the box - if you have ``djangorestframework-recursive`` installe
drf-extra-fields
=================

Integration with `drf-extra-fields <https://github.com/Hipo/drf-extra-fields>`_ has a problem with Base64 fields.
Integration with `drf-extra-fields <https://github.com/Hipo/drf-extra-fields>`_ has a problem with Base64 fields.
The drf-yasg will generate Base64 file or image fields as Readonly and not required. Here is a workaround code
for display the Base64 fields correctly.

.. code:: python
class PDFBase64FileField(Base64FileField):
ALLOWED_TYPES = ['pdf']
class Meta:
swagger_schema_fields = {
'type': 'string',
'title': 'File Content',
'description': 'Content of the file base64 encoded',
'read_only': False # <-- FIX
}
def get_file_extension(self, filename, decoded_file):
try:
PyPDF2.PdfFileReader(io.BytesIO(decoded_file))
Expand Down
2 changes: 1 addition & 1 deletion requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pytest-cov>=2.6.0
pytest-xdist>=1.25.0
pytest-django>=3.4.4
datadiff==2.0.0
psycopg2-binary==2.9.4
psycopg2-binary==2.9.5
django-fake-model==0.1.4

-r testproj.txt
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ envlist =
py{37,38,39}-django{22,30}-drf{310,311,312},
py{37,38,39}-django{31,32}-drf{311,312},
py{39,310}-django{40,41}-drf{313,314}
py311-django{40,41}-drf314
py38-{lint, docs},
py39-djmaster

Expand Down

0 comments on commit 25b7ca7

Please sign in to comment.