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

Django
2019-12-25 15:14 (4 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

Comments

Archive

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