Upgrading to Django 3: from_db_value() missing 1 required positional argument: 'context' Error Occurs

Django
2019-12-25 06:14 (6 years ago)
Upgrading to Django 3: from_db_value() missing 1 required positional argument: 'context' Error Occurs

TypeError

from_db_value() missing 1 required positional argument: 'context'

When this error appears

In Django 3, the arguments for the model field's from_db_value method have been changed from:

def from_db_value(self, value, expression, connection, context):

to

def from_db_value(self, value, expression, connection):

Therefore, any function that takes context as an argument needs to be revised.

I encountered this issue with an older version of social_django (social-auth-app-django).

Currently unrated
The author runs the application development company Cyberneura.
We look forward to discussing your development needs.

Categories

Archive