Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Django 1.10 Deprecation Warning "SubfieldBase has been deprecated." #813

Merged
merged 1 commit into from
Apr 3, 2016
Merged

Fix Django 1.10 Deprecation Warning "SubfieldBase has been deprecated." #813

merged 1 commit into from
Apr 3, 2016

Conversation

contracode
Copy link
Contributor

Removed metaclass syntax to break the dependency on django.db.models.SubfieldBase, which has been deprecated in Django 1.9 and will be removed with Django 1.10.

Fixes #804 and #754. Extends fix provided by #806.

@gustavi
Copy link

gustavi commented Jan 6, 2016

Thank you for the PR, someone can review and merge it ?

@gustavi
Copy link

gustavi commented Jan 10, 2016

Some news ?

@gustavi
Copy link

gustavi commented Jan 14, 2016

?

@yprez
Copy link
Contributor

yprez commented Jan 14, 2016

+1

@yprez
Copy link
Contributor

yprez commented Jan 14, 2016

Also fixes #812 #811 #801

@liminspace
Copy link

+1

@blueyed
Copy link

blueyed commented Jan 25, 2016

Please stop +1'ing without providing some input/findings/patch.

FWIW, you can use something like the following to filter out warnings unrelated to your project:

import project
PROJECT_PATH = os.path.dirname(project.__file__)

def filter_deprecation_warnings(record):
    warnings_to_suppress = [
        'RemovedInDjango110Warning'
    ]
    msg = record.getMessage()
    return not any([warn in msg
                    for warn in warnings_to_suppress
                    if not msg.startswith(PROJECT_PATH)])
logging.getLogger('py.warnings').addFilter(filter_deprecation_warnings)

@yprez
Copy link
Contributor

yprez commented Jan 25, 2016

@blueyed this is the patch... just showing that there is interest (github lacks voting).

@blueyed
Copy link

blueyed commented Jan 25, 2016

@yprez
You've added some info at least, so that was OKish.

It was meant more in general.

And regarding your comment (which were actually 2, so two emails for maintainers), it would be better to add it to the duplicate issues and reference this one from there, clearing stating that it's a dupe / fixed by this PR - so it can be easily triaged.
Otherwise all the noise will only make it harder for maintainers.
That's also why we should stop here discussing this.

@contracode
Copy link
Contributor Author

Is there anything I can clarify or add to get this PR merged?

@duducosmos
Copy link

+1

@PetrVasilev
Copy link

Where i have to add "def filter_deprecation_warnings(record):" in my project???

@yamashitadesu
Copy link

Hi, I also have the Bug with Django 1.9.2.
I found this page, and I reinstalled python-social-auth by
$ git clone https://github.com/omab/python-social-auth
and
$ python setup.py install

But I still have the Bug. Should I use Django 1.10? Or Can I solve this Bug on Django 1.9?

Thank you.

@PetrVasilev
Copy link

Hi, I also have this bug, and I tried fix it. You can do exception in
your project, and it will works.

2016-02-20 9:57 GMT+09:00 yamashitadesu notifications@github.com:

Hi, I also have the Bug with Django 1.9.2.
I found this page
http://stackoverflow.com/questions/34321332/subfieldbase-has-been-deprecated-use-field-from-db-value-instead,
and I reinstalled python-social-auth by
$ git clone https://github.com/omab/python-social-auth
and
$ python setup.py install

But I still have the Bug. Should I use Django 1.10? Or Can I solve this
Bug on Django 1.9?

Thank you.


Reply to this email directly or view it on GitHub
#813 (comment)
.

// Васильев Петр Алексеевич

@gustavi
Copy link

gustavi commented Feb 20, 2016

I have no idea why nobody wants to merge it. Really.

@PetrVasilev
Copy link

Me too, it is really bad problem for me

2016-02-20 19:38 GMT+09:00 Laville Augustin notifications@github.com:

I have no idea why nobody wants to merge it. Really.


Reply to this email directly or view it on GitHub
#813 (comment)
.

// Васильев Петр Алексеевич

@contracode
Copy link
Contributor Author

Could you review and merge this, please, @omab? If you do not have the time to do this, please consider granting me write access to this repo. I can ensure you that I will assist you in bug triage, pull request review/merge, and the other maintenance tasks related to providing quality code to the world.

@evcb
Copy link
Contributor

evcb commented Feb 21, 2016

Can it be also updated on pip repository?

@AlbertPuchala
Copy link

When I change this line manually and try to use Google auth, I get Error:

AttributeError at /accounts/social/complete/google-oauth2/
'str' object has no attribute 'update'
Request Method: GET
Request URL: http://myapp.com:8000/accounts/social/complete/google-oauth2/?state=2M0kJYG5Y6gY2168PvXZYoSASqvkaGhk&code=4/oSlipMXmeksLQO8ekcGnWVtm9ZPFv1oBpJptr4Cm0wk&authuser=0&session_state=150dc7ee96507db45d657099378028204c576a4a..dfee&prompt=none
Django Version: 1.9.2
Exception Type: AttributeError
Exception Value:
'str' object has no attribute 'update'
Exception Location: /home/albert/HomeFinder/env/lib/python3.4/site-packages/social/storage/base.py in set_extra_data, line 85
Python Executable: /home/albert/HomeFinder/env/bin/python
Python Version: 3.4.3

Without this change everything works fine.
What am I doing wrong?

@evcb
Copy link
Contributor

evcb commented Mar 3, 2016

@AlbertPuchala What was the modification you made? I believe I have to add and not isinstance(self.extra_data, str).

@AlbertPuchala
Copy link

@hellvix Thanks, now it works :).
But shouldn't that (which you've pasted) change be appended to this branch?

@evcb
Copy link
Contributor

evcb commented Mar 11, 2016

@AlbertPuchala It should, but I believe @omab is really busy. He hasn't been updating the stuff we have around.

@vaibhavmule
Copy link

Any progress on this?

@omab omab merged commit 2259fc4 into omab:master Apr 3, 2016
@omab
Copy link
Owner

omab commented Apr 3, 2016

Sorry about the delay, I'm very busy but slowly catching up with all the PRs proposed.

Thanks!

@evcb
Copy link
Contributor

evcb commented Apr 20, 2016

Should have been fixed. Update your version and let us know here the
outcome.
On 20 Apr 2016 10:58, "Julian Bez" notifications@github.com wrote:

@hellvix https://github.com/hellvix was the fix added? I have the same
problem as @AlbertPuchala https://github.com/AlbertPuchala.. which line
do I need to change?


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#813 (comment)

@cleder
Copy link

cleder commented Oct 6, 2016

This warning in Django 1.9 may be a red herring. I did have it and migrated to 1.10 without any problems. If you are on 1.9 and the warning holds you back, just give it a try to migrate to 1.10 (and run your tests ;-) )

@ashishpahwa7
Copy link

I have migrated to 1.10 and still facing the same issue :

class JSONField(six.with_metaclass(models.SubfieldBase,models.TextField)): AttributeError: 'module' object has no attribute 'SubfieldBase'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Django 1.9.0 Deprecation Warning