omab / python-social-auth

Social auth made simple
http://psa.matiasaguirre.net
BSD 3-Clause "New" or "Revised" License
2.83k stars 1.09k forks source link

RemovedInDjango110Warning: SubfieldBase has been deprecated. #997

Closed tom-dalton-fanduel closed 7 years ago

tom-dalton-fanduel commented 8 years ago

Using 0.2.21 with Django 1.9, I get the following deprecation warning:

RemovedInDjango110Warning: SubfieldBase has been deprecated. Use Field.from_db_value instead.

It looks like this was originally a problem and was fixed by #813. However, it looks like recently the warning was reintroduced, by this:

https://github.com/omab/python-social-auth/commit/03ae00154900a8150a5bf941663425698aacdb6b#diff-25f350079af94bedfb90b3a9e8cafb59R15

tom-dalton-fanduel commented 8 years ago

I wonder if the try/catch:

try:
    from django.db.models import SubfieldBase
    field_class = functools.partial(six.with_metaclass, SubfieldBase)
except ImportError:
    field_class = functools.partial(six.with_metaclass, type)

could be replaced with a version check along the lines of:

# SubfieldBase causes RemovedInDjango110Warning in 1.8 and 1.9, and will not work in 1.10 or later
import django
if django.VERSION[:2] >= (1, 8):
    field_class = functools.partial(six.with_metaclass, type)
else:
    from django.db.models import SubfieldBase
    field_class = functools.partial(six.with_metaclass, SubfieldBase)
ThibautNicodeme commented 8 years ago

Having the same issue. It doesn't seem to be blocking anything, but it'd be nice if it could be fixed. Especially since it apparently was back in October last year?

tom-dalton-fanduel commented 8 years ago

Created a PR with the proposed fix from above: #1008

omab commented 7 years ago

The fix for this issue got merged into the social-app-django component.