diff --git a/README.md b/README.md index 2e843074a..f875f65dd 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ Some reasons you might want to use REST framework: # Requirements * Python 3.10+ -* Django 4.2, 5.0, 5.1, 5.2 +* Django 4.2, 5.0, 5.1, 5.2, 6.0 We **highly recommend** and only officially support the latest patch release of each Python and Django series. diff --git a/docs/api-guide/serializers.md b/docs/api-guide/serializers.md index 8d4da4ee4..e94b943a2 100644 --- a/docs/api-guide/serializers.md +++ b/docs/api-guide/serializers.md @@ -708,7 +708,7 @@ You can override a URL field view name and lookup field by using either, or both class AccountSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Account - fields = ['account_url', 'account_name', 'users', 'created'] + fields = ['url', 'account_name', 'users', 'created'] extra_kwargs = { 'url': {'view_name': 'accounts', 'lookup_field': 'account_name'}, 'users': {'lookup_field': 'username'} diff --git a/pyproject.toml b/pyproject.toml index 37fef3bd2..da608a26c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,6 +18,7 @@ classifiers = [ "Framework :: Django :: 5.0", "Framework :: Django :: 5.1", "Framework :: Django :: 5.2", + "Framework :: Django :: 6.0", "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python", diff --git a/rest_framework/locale/pt_BR/LC_MESSAGES/django.mo b/rest_framework/locale/pt_BR/LC_MESSAGES/django.mo index 03a0651fa..cf9f4c27c 100644 Binary files a/rest_framework/locale/pt_BR/LC_MESSAGES/django.mo and b/rest_framework/locale/pt_BR/LC_MESSAGES/django.mo differ diff --git a/rest_framework/locale/pt_BR/LC_MESSAGES/django.po b/rest_framework/locale/pt_BR/LC_MESSAGES/django.po index bfd53ee0f..c502ab2ab 100644 --- a/rest_framework/locale/pt_BR/LC_MESSAGES/django.po +++ b/rest_framework/locale/pt_BR/LC_MESSAGES/django.po @@ -11,13 +11,14 @@ # Jonatas Baldin , 2017 # Gabriel Mitelman Tkacz , 2024 # Matheus Oliveira , 2025 +# João Victor Pinheiro Reis , 2025 msgid "" msgstr "" "Project-Id-Version: Django REST framework\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-13 21:45+0200\n" -"PO-Revision-Date: 2020-10-13 19:45+0000\n" -"Last-Translator: Xavier Ordoquy \n" +"POT-Creation-Date: 2025-11-18 17:00+0300\n" +"PO-Revision-Date: 2025-11-18 14:00+0000\n" +"Last-Translator: João Victor Pinheiro Reis \n" "Language-Team: Portuguese (Brazil) (http://www.transifex.com/django-rest-framework-1/django-rest-framework/language/pt_BR/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -35,11 +36,11 @@ msgstr "Cabeçalho básico inválido. String de credenciais não deve incluir es #: authentication.py:83 msgid "Invalid basic header. Credentials not correctly base64 encoded." -msgstr "Cabeçalho básico inválido. Credenciais codificadas em base64 incorretamente." +msgstr "Cabeçalho básico inválido. Credenciais não foram corretamente codificadas em base64." #: authentication.py:101 msgid "Invalid username/password." -msgstr "Usuário ou senha inválido." +msgstr "Usuário ou senha inválidos." #: authentication.py:104 authentication.py:206 msgid "User inactive or deleted." @@ -56,7 +57,7 @@ msgstr "Cabeçalho de token inválido. String de token não deve incluir espaço #: authentication.py:193 msgid "" "Invalid token header. Token string should not contain invalid characters." -msgstr "Cabeçalho de token inválido. String de token não deve possuir caracteres inválidos." +msgstr "Cabeçalho de token inválido. String de token não deveria possuir caracteres inválidos." #: authentication.py:203 msgid "Invalid token." @@ -88,7 +89,7 @@ msgstr "Tokens" #: authtoken/serializers.py:9 msgid "Username" -msgstr "Nome do usuário" +msgstr "Nome de usuário" #: authtoken/serializers.py:13 msgid "Password" @@ -100,11 +101,11 @@ msgstr "Impossível fazer login com as credenciais fornecidas." #: authtoken/serializers.py:38 msgid "Must include \"username\" and \"password\"." -msgstr "Obrigatório incluir \"usuário\" e \"senha\"." +msgstr "Deve incluir \"username\" e \"password\"." #: exceptions.py:102 msgid "A server error occurred." -msgstr "Ocorreu um erro de servidor." +msgstr "Um erro de servidor ocorreu." #: exceptions.py:142 msgid "Invalid input." @@ -142,21 +143,21 @@ msgstr "Não foi possível satisfazer a requisição do cabeçalho Accept." #: exceptions.py:212 #, python-brace-format msgid "Unsupported media type \"{media_type}\" in request." -msgstr "Tipo de mídia \"{media_type}\" no pedido não é suportado." +msgstr "Tipo de mídia \"{media_type}\" não é suportado." #: exceptions.py:223 msgid "Request was throttled." -msgstr "Pedido foi limitado." +msgstr "Pedido foi suprimido." #: exceptions.py:224 #, python-brace-format msgid "Expected available in {wait} second." -msgstr "Disponível em {wait} segundo." +msgstr "Espera-se que esteja diponível em {wait} segundo." #: exceptions.py:225 #, python-brace-format msgid "Expected available in {wait} seconds." -msgstr "Disponível em {wait} segundos." +msgstr "Espera-se que esteja diponível em {wait} segundos." #: fields.py:316 relations.py:245 relations.py:279 validators.py:90 #: validators.py:183 @@ -165,7 +166,7 @@ msgstr "Este campo é obrigatório." #: fields.py:317 msgid "This field may not be null." -msgstr "Este campo não pode ser nulo." +msgstr "Este campo pode não ser nulo." #: fields.py:701 msgid "Must be a valid boolean." @@ -177,7 +178,7 @@ msgstr "Não é uma string válida." #: fields.py:767 msgid "This field may not be blank." -msgstr "Este campo não pode estar em branco." +msgstr "Este campo pode não estar em branco." #: fields.py:768 fields.py:1881 #, python-brace-format @@ -201,13 +202,13 @@ msgstr "Este valor não corresponde ao padrão exigido." msgid "" "Enter a valid \"slug\" consisting of letters, numbers, underscores or " "hyphens." -msgstr "Insira um \"slug\" válido que consista de letras, números, sublinhados ou hífens." +msgstr "Insira um \"slug\" válido que consista em letras, números, sublinhados ou hífens." #: fields.py:839 msgid "" "Enter a valid \"slug\" consisting of Unicode letters, numbers, underscores, " "or hyphens." -msgstr "Insira um \"slug\" válido que consista de letras Unicode, números, sublinhados ou hífens." +msgstr "Insira um \"slug\" válido que consista em letras, números, sublinhados ou hífens Unicode." #: fields.py:854 msgid "Enter a valid URL." @@ -268,7 +269,7 @@ msgstr "Formato inválido para data e hora. Use um dos formatos a seguir: {forma #: fields.py:1149 msgid "Expected a datetime but got a date." -msgstr "Necessário uma data e hora mas recebeu uma data." +msgstr "Esperava data e hora, mas recebeu data." #: fields.py:1150 #, python-brace-format @@ -282,11 +283,11 @@ msgstr "Valor de data e hora fora do intervalo." #: fields.py:1236 #, python-brace-format msgid "Date has wrong format. Use one of these formats instead: {format}." -msgstr "Formato inválido para data. Use um dos formatos a seguir: {format}." +msgstr "Formato de data inválido. Use um dos formatos a seguir: {format}." #: fields.py:1237 msgid "Expected a date but got a datetime." -msgstr "Necessário uma data mas recebeu uma data e hora." +msgstr "Esperava data, mas recebeu data e hora." #: fields.py:1303 #, python-brace-format @@ -301,7 +302,7 @@ msgstr "Formato inválido para duração. Use um dos formatos a seguir: {format} #: fields.py:1399 fields.py:1456 #, python-brace-format msgid "\"{input}\" is not a valid choice." -msgstr "\"{input}\" não é um escolha válida." +msgstr "\"{input}\" não é uma escolha válida." #: fields.py:1402 #, python-brace-format @@ -315,12 +316,12 @@ msgstr "Esperava uma lista de itens, mas recebeu tipo \"{input_type}\"." #: fields.py:1458 msgid "This selection may not be empty." -msgstr "Esta seleção não pode estar vazia." +msgstr "Esta seleção pode não estar vazia." #: fields.py:1495 #, python-brace-format msgid "\"{input}\" is not a valid path choice." -msgstr "\"{input}\" não é uma escolha válida para um caminho." +msgstr "\"{input}\" não é uma escolha válida de caminho." #: fields.py:1514 msgid "No file was submitted." @@ -329,7 +330,7 @@ msgstr "Nenhum arquivo foi submetido." #: fields.py:1515 msgid "" "The submitted data was not a file. Check the encoding type on the form." -msgstr "O dado submetido não é um arquivo. Certifique-se do tipo de codificação no formulário." +msgstr "O dado submetido não era um arquivo. Cheque o tipo de codificação no formulário." #: fields.py:1516 msgid "No filename could be determined." @@ -343,7 +344,7 @@ msgstr "O arquivo submetido está vázio." #, python-brace-format msgid "" "Ensure this filename has at most {max_length} characters (it has {length})." -msgstr "Certifique-se de que o nome do arquivo tem menos de {max_length} caracteres (tem {length})." +msgstr "Certifique-se de que o nome do arquivo tenho no máximo {max_length} caracteres (tem {length})." #: fields.py:1566 msgid "" @@ -353,7 +354,7 @@ msgstr "Faça upload de uma imagem válida. O arquivo enviado não é um arquivo #: fields.py:1604 relations.py:486 serializers.py:571 msgid "This list may not be empty." -msgstr "Esta lista não pode estar vazia." +msgstr "Esta lista pode não estar vazia." #: fields.py:1605 #, python-brace-format @@ -368,11 +369,11 @@ msgstr "Certifique-se de que este campo não tenha mais que {max_length} element #: fields.py:1682 #, python-brace-format msgid "Expected a dictionary of items but got type \"{input_type}\"." -msgstr "Esperava um dicionário de itens mas recebeu tipo \"{input_type}\"." +msgstr "Esperava um dicionário de itens, mas recebeu tipo \"{input_type}\"." #: fields.py:1683 msgid "This dictionary may not be empty." -msgstr "Este dicionário não pode estar vazio." +msgstr "Este dicionário pode não estar vazio." #: fields.py:1755 msgid "Value must be valid JSON." @@ -451,7 +452,7 @@ msgstr "Hyperlink inválido - Objeto não existe." #: relations.py:283 #, python-brace-format msgid "Incorrect type. Expected URL string, received {data_type}." -msgstr "Tipo incorreto. Necessário string URL, recebeu {data_type}." +msgstr "Tipo incorreto. Esperava string URL, recebeu {data_type}." #: relations.py:448 #, python-brace-format @@ -482,7 +483,7 @@ msgstr "Um {value_type} que identifica este {name}." #: serializers.py:337 #, python-brace-format msgid "Invalid data. Expected a dictionary, but got {datatype}." -msgstr "Dado inválido. Necessário um dicionário mas recebeu {datatype}." +msgstr "Dado inválido. Esperava um dicionário, mas recebeu {datatype}." #: templates/rest_framework/admin.html:116 #: templates/rest_framework/base.html:136 @@ -500,23 +501,23 @@ msgstr "" #: templates/rest_framework/base.html:75 msgid "content" -msgstr "" +msgstr "conteúdo" #: templates/rest_framework/base.html:78 msgid "request form" -msgstr "" +msgstr "formulário de requisição" #: templates/rest_framework/base.html:157 msgid "main content" -msgstr "" +msgstr "conteúdo principal" #: templates/rest_framework/base.html:173 msgid "request info" -msgstr "" +msgstr "informações da requisição" #: templates/rest_framework/base.html:177 msgid "response info" -msgstr "" +msgstr "informações da resposta" #: templates/rest_framework/horizontal/radio.html:4 #: templates/rest_framework/inline/radio.html:3 @@ -528,11 +529,11 @@ msgstr "Nenhum(a/as)" #: templates/rest_framework/inline/select_multiple.html:3 #: templates/rest_framework/vertical/select_multiple.html:3 msgid "No items to select." -msgstr "Nenhum item para escholher." +msgstr "Nenhum item para selecionar." #: validators.py:39 msgid "This field must be unique." -msgstr "Esse campo deve ser único." +msgstr "Este campo deve ser único." #: validators.py:89 #, python-brace-format @@ -547,17 +548,17 @@ msgstr "Caracteres substitutos não são permitidos: U+{code_point:X}." #: validators.py:243 #, python-brace-format msgid "This field must be unique for the \"{date_field}\" date." -msgstr "O campo \"{date_field}\" deve ser único para a data." +msgstr "Este campo deve ser único para a data de \"{date_field}\"." #: validators.py:258 #, python-brace-format msgid "This field must be unique for the \"{date_field}\" month." -msgstr "O campo \"{date_field}\" deve ser único para o mês." +msgstr "Este campo deve ser único para o mês de \"{date_field}\"." #: validators.py:271 #, python-brace-format msgid "This field must be unique for the \"{date_field}\" year." -msgstr "O campo \"{date_field}\" deve ser único para o ano." +msgstr "Este campo deve ser único para o ano de \"{date_field}\"." #: versioning.py:40 msgid "Invalid version in \"Accept\" header." @@ -577,4 +578,4 @@ msgstr "Versão inválida no hostname." #: versioning.py:170 msgid "Invalid version in query parameter." -msgstr "Versão inválida no parâmetro de query." +msgstr "Versão inválida no parâmetro de consulta." diff --git a/tests/conftest.py b/tests/conftest.py index 01914ae77..11a079f48 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -15,6 +15,7 @@ def pytest_configure(config): settings.configure( DEBUG_PROPAGATE_EXCEPTIONS=True, + DEFAULT_AUTO_FIELD="django.db.models.AutoField", DATABASES={ 'default': { 'ENGINE': 'django.db.backends.sqlite3', diff --git a/tests/test_templatetags.py b/tests/test_templatetags.py index 7134c1bae..8260fc839 100644 --- a/tests/test_templatetags.py +++ b/tests/test_templatetags.py @@ -1,7 +1,7 @@ import unittest from django.template import Context, Template -from django.test import TestCase +from django.test import TestCase, override_settings from django.utils.html import urlize from rest_framework.compat import coreapi, coreschema @@ -240,6 +240,7 @@ class Issue1386Tests(TestCase): Covers #1386 """ + @override_settings(URLIZE_ASSUME_HTTPS=True) def test_issue_1386(self): """ Test function urlize with different args diff --git a/tests/test_validators.py b/tests/test_validators.py index 79d4c0cf8..96354b9b1 100644 --- a/tests/test_validators.py +++ b/tests/test_validators.py @@ -752,7 +752,7 @@ class TestUniqueConstraintValidation(TestCase): validators = serializer.fields['fancy_conditions'].validators assert len(validators) == 2 + extra_validators_qty - ids_in_qs = {frozenset(v.queryset.values_list(flat=True)) for v in validators if hasattr(v, "queryset")} + ids_in_qs = {frozenset(v.queryset.values_list('id', flat=True)) for v in validators if hasattr(v, "queryset")} assert ids_in_qs == {frozenset([1]), frozenset([3])} def test_nullable_unique_constraint_fields_are_not_required(self): diff --git a/tox.ini b/tox.ini index b27c13d0f..6980d0bfa 100644 --- a/tox.ini +++ b/tox.ini @@ -2,9 +2,9 @@ envlist = {py310}-{django42,django51,django52} {py311}-{django42,django51,django52} - {py312}-{django42,django51,django52,djangomain} - {py313}-{django51,django52,djangomain} - {py314}-{django52,djangomain} + {py312}-{django42,django51,django52,django60,djangomain} + {py313}-{django51,django52,django60,djangomain} + {py314}-{django52,django60,djangomain} base dist docs @@ -20,6 +20,7 @@ deps = django50: Django>=5.0,<5.1 django51: Django>=5.1,<5.2 django52: Django>=5.2,<6.0 + django60: Django>=6.0,<6.1 djangomain: https://github.com/django/django/archive/main.tar.gz -rrequirements/requirements-testing.txt -rrequirements/requirements-optionals.txt @@ -27,13 +28,13 @@ deps = [testenv:base] ; Ensure optional dependencies are not required deps = - django<6.0 + django<6.1 -rrequirements/requirements-testing.txt [testenv:dist] commands = python -W error::DeprecationWarning -W error::PendingDeprecationWarning runtests.py --no-pkgroot --staticfiles {posargs} deps = - django<6.0 + django<6.1 -rrequirements/requirements-testing.txt -rrequirements/requirements-optionals.txt