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

Django
2019-12-25 15:14 (5 years ago) ytyng

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.

Archive

2025
2024
2023
2022
2021
2020
2019
2018
2017
2016
2015
2014
2013
2012
2011