AttributeError: '__proxy__' object has no attribute '_delegate_text' #9259
Unanswered
fl4t1
asked this question in
Potential Issue
Replies: 1 comment 1 reply
-
i think we still do not support django 5.0 officially. a PR is open which should be merged soon. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
It seems that DRF smart_repr is trying to access _delegate_text from django.utils.functional, which does not exist on Promise in django.utils.functional anymore. Or is something wrong with my code?
Django==5.0.1 and djangorestframework==3.14.0
`from django.utils.translation import gettext_lazy as _
class CustomUser(AbstractUser):
email = models.EmailField(_("email address"), unique=True)
....
class CustomUserSerializer(serializers.ModelSerializer):
class Meta:
model = CustomUser
fields = ["email", "first_name", "last_name"]
read_only_fields = ["email", "first_name", "last_name"]
serializer = CustomUserSerializer()
print(repr(serializer))
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/lib/python3.11/site-packages/rest_framework/serializers.py", line 530, in repr
return representation.serializer_repr(self, indent=1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/rest_framework/utils/representation.py", line 82, in serializer_repr
ret += serializer_repr(field, indent + 1)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/rest_framework/utils/representation.py", line 88, in serializer_repr
ret += field_repr(field)
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/rest_framework/utils/representation.py", line 55, in field_repr
kwarg_string = ', '.join([
^
File "/usr/local/lib/python3.11/site-packages/rest_framework/utils/representation.py", line 56, in
'%s=%s' % (key, smart_repr(val))
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/rest_framework/utils/representation.py", line 30, in smart_repr
if isinstance(value, Promise) and value._delegate_text:
^^^^^^^^^^^^^^^^^^^^
AttributeError: 'proxy' object has no attribute '_delegate_text'
`
Beta Was this translation helpful? Give feedback.
All reactions