Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

Upgrade to Django 2.2 #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion connected_accounts/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = '0.1.5'
__version__ = '0.2.0'

default_app_config = 'connected_accounts.apps.ConnectedAccountsConfig'
2 changes: 1 addition & 1 deletion connected_accounts/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from django.contrib.admin.options import IS_POPUP_VAR
from django.contrib.admin.templatetags.admin_urls import add_preserved_filters
from django.core.exceptions import PermissionDenied
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import redirect
from django.template.loader import render_to_string
Expand Down
2 changes: 1 addition & 1 deletion connected_accounts/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-


from appconf import AppConf
from django.conf import settings # noqa
Expand Down
19 changes: 9 additions & 10 deletions connected_accounts/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class AccountField(ForeignKey):

def __init__(self, provider, **kwargs):
def __init__(self, provider, on_delete, **kwargs):
if 'to' in kwargs:
del(kwargs['to'])

Expand All @@ -12,18 +12,17 @@ def __init__(self, provider, **kwargs):

# We hard-code the `to` argument for ForeignKey.__init__
# since a AccountField can only be a ForeignKey to a Account
kwargs['to'] = 'connected_accounts.Account'
super(AccountField, self).__init__(**kwargs)
super(AccountField, self).__init__('connected_accounts.Account', on_delete=on_delete, **kwargs)

def deconstruct(self):
name, path, args, kwargs = super(AccountField, self).deconstruct()
kwargs['provider'] = self.provider
return name, path, args, kwargs

def south_field_triple(self):
"""Returns a suitable description of this field for South."""
# We'll just introspect ourselves, since we inherit.
from south.modelsinspector import introspector
field_class = 'django.db.models.fields.related.ForeignKey'
args, kwargs = introspector(self)
return (field_class, args, kwargs)
# def south_field_triple(self):
# """Returns a suitable description of this field for South."""
# # We'll just introspect ourselves, since we inherit.
# from south.modelsinspector import introspector
# field_class = 'django.db.models.fields.related.ForeignKey'
# args, kwargs = introspector(self)
# return (field_class, args, kwargs)
6 changes: 3 additions & 3 deletions connected_accounts/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals



from django.conf import settings
from django.db import migrations, models
Expand Down Expand Up @@ -28,7 +28,7 @@ class Migration(migrations.Migration):
('oauth_token_secret', models.TextField(help_text='"oauth_token_secret" (OAuth1) or refresh token (OAuth2)', null=True, verbose_name='OAuth Token Secret', blank=True)),
('extra_data', JSONField(verbose_name='Extra data', editable=False)),
('expires_at', models.DateTimeField(null=True, verbose_name='Expires at', blank=True)),
('user', models.ForeignKey(editable=False, to=settings.AUTH_USER_MODEL, verbose_name='User')),
('user', models.ForeignKey(on_delete=models.deletion.CASCADE, editable=False, to=settings.AUTH_USER_MODEL, verbose_name='User')),
],
options={
'ordering': ('-last_login',),
Expand Down
6 changes: 3 additions & 3 deletions connected_accounts/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals



import json
import logging
Expand All @@ -20,7 +20,7 @@
@python_2_unicode_compatible
class Account(models.Model):
user = models.ForeignKey(
settings.AUTH_USER_MODEL, verbose_name=_('User'), editable=False)
settings.AUTH_USER_MODEL, verbose_name=_('User'), editable=False, on_delete=models.CASCADE)
provider = models.CharField(
verbose_name=_('Provider'), max_length=50,
choices=providers.as_choices())
Expand Down
2 changes: 1 addition & 1 deletion connected_accounts/providers/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from __future__ import unicode_literals


import json
import logging
Expand Down
4 changes: 2 additions & 2 deletions connected_accounts/south_migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-

from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
Expand Down Expand Up @@ -83,4 +83,4 @@ def backwards(self, orm):
}
}

complete_apps = ['connected_accounts']
complete_apps = ['connected_accounts']
4 changes: 2 additions & 2 deletions connected_accounts/views.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from __future__ import unicode_literals


import logging

from django.contrib import messages
from django.contrib.admin.templatetags.admin_urls import add_preserved_filters
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.http import Http404
from django.shortcuts import redirect
from django.utils.encoding import force_text
Expand Down
2 changes: 1 addition & 1 deletion connected_accounts/widgets.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.contrib.admin.widgets import ForeignKeyRawIdWidget
from django.core.urlresolvers import reverse
from django.urls import reverse
from django.template.loader import render_to_string
from django.utils.safestring import mark_safe

Expand Down
12 changes: 6 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-


import os
import sys
Expand Down Expand Up @@ -52,10 +52,10 @@
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Natural Language :: English',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
],
)
2 changes: 1 addition & 1 deletion tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-


"""
test_django-connected
Expand Down