Skip to content

Commit

Permalink
Upgrade to Django 2.2
Browse files Browse the repository at this point in the history
WARNING:

- [2.1] mysqlclient mysqlclient is increased from 1.3.3 to 1.3.7.
  https://docs.djangoproject.com/en/2.2/releases/2.1/#miscellaneous

- [2.1] Since migrations are now loaded from .pyc files, you might
  need to delete them if you’re working in a mixed Python 2 and Python
  3 environment.
  https://docs.djangoproject.com/en/2.2/releases/2.1/#miscellaneous

- removed south migrations

Upgrade path details:

- [1.9] on_delete for foreignkey and onetoone fields
  https://docs.djangoproject.com/en/2.2/releases/1.9/#foreignkey-and-onetoonefield-on-delete-argument

- [1.9] https://docs.djangoproject.com/en/2.2/releases/1.9/#passing-a-3-tuple-or-an-app-name-to-include

- [1.10] The django.core.urlresolvers module is removed in favor of its new
  location, django.urls.
  https://docs.djangoproject.com/en/2.2/releases/1.10/#id3

- [1.10] https://docs.djangoproject.com/en/2.2/releases/1.10/#new-style-middleware
  https://docs.djangoproject.com/en/2.2/topics/http/middleware/#upgrading-middleware

- [1.11] contrib.auth.views.login() deprecated
  https://docs.djangoproject.com/en/2.2/releases/1.11/#id2

- [2.??] urlenquote stoped accepting bytestring
  • Loading branch information
tibonihoo committed Jun 2, 2019
1 parent 77dbbf9 commit dee041d
Show file tree
Hide file tree
Showing 31 changed files with 32 additions and 937 deletions.
3 changes: 1 addition & 2 deletions requirements_base.txt
@@ -1,5 +1,4 @@
Django>=1.11.19,<2.0
South==1.0.1
Django>=2.2,<2.3
feedparser>=5.2.1,<6.0
beautifulsoup4
granary==1.14
Expand Down
7 changes: 3 additions & 4 deletions wateronmars/settings.py
Expand Up @@ -205,16 +205,15 @@
]


MIDDLEWARE_CLASSES = (
MIDDLEWARE = [
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
# Uncomment the next line for simple clickjacking protection:
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'wateronmars.urls'

Expand Down
6 changes: 3 additions & 3 deletions wateronmars/urls.py
Expand Up @@ -53,15 +53,15 @@
user_auth_landing_twitter,
)

from django.contrib.auth.views import login
from django.contrib.auth import views as auth_views
from django.views.static import serve as static_serve


urlpatterns = [
url(r'^robots.txt$', get_robots_txt),
url(r'^humans.txt$', get_humans_txt),
url(r'^$', home, name='home'),
url(r'^accounts/login/$', login, {'template_name': 'login.html'}, name='user_login'),
url(r'^accounts/login/$', auth_views.LoginView.as_view(template_name='login.html'), name='user_login'),
url(r'^accounts/logout/$', user_logout, name='user_logout'),
url(r'^accounts/profile/$', user_profile, name='user_profile'),
url(r'^u/(?P<owner_name>[^/]*)/$', user_root, name='user_root'),
Expand Down Expand Up @@ -94,7 +94,7 @@
urlpatterns += [
url(r'^accounts/new/$', user_creation),
url(r'^accounts/auth_landing/twitter/$', user_auth_landing_twitter, name='user_auth_landing_twitter'),
url(r'^admin/', include(admin.site.urls)),
url(r'^admin/', admin.site.urls),
# Uncomment the admin/doc line below to
# enable admin documentation
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
Expand Down
4 changes: 2 additions & 2 deletions wom_classification/models.py
Expand Up @@ -54,11 +54,11 @@ class ClassificationData(models.Model):
and its user-specific classification data ("features" in machine
learning terminology)."""

owner = models.ForeignKey(User)
owner = models.ForeignKey(User, on_delete=models.CASCADE)

tags = models.ManyToManyField(Tag)

content_type = models.ForeignKey(ContentType)
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
object_id = models.PositiveIntegerField()
content_object = GenericForeignKey('content_type', 'object_id')

Expand Down
99 changes: 0 additions & 99 deletions wom_classification/south_migrations/0001_initial.py

This file was deleted.

Empty file.
52 changes: 0 additions & 52 deletions wom_pebbles/south_migrations/0001_initial.py

This file was deleted.

This file was deleted.

Empty file.
2 changes: 1 addition & 1 deletion wom_river/models.py
Expand Up @@ -29,7 +29,7 @@ class WebFeed(models.Model):
reference to be considered as a source of news items.
"""
# Reference considered as the source
source = models.ForeignKey(Reference)
source = models.ForeignKey(Reference, on_delete=models.CASCADE)
# The URL where to get updated list of References from
xmlURL = models.CharField(max_length=URL_MAX_LENGTH)
# Date marking the last time the source was checked for an update
Expand Down
46 changes: 0 additions & 46 deletions wom_river/south_migrations/0001_initial.py

This file was deleted.

Empty file.
4 changes: 2 additions & 2 deletions wom_river/tests.py
Expand Up @@ -208,7 +208,7 @@ def setUp(self):
</rss>
""" % ("u"*(URL_MAX_LENGTH),"u"*(URL_MAX_LENGTH))

f1 = feedparser.parse(rss_xml.encode("utf-8"))
f1 = feedparser.parse(rss_xml)
self.ref_and_tags = add_new_references_from_feedparser_entries(web_feed,
f1.entries)

Expand Down Expand Up @@ -315,7 +315,7 @@ def setUp(self):
</rss>
"""

f1 = feedparser.parse(rss_xml.encode("utf-8"))
f1 = feedparser.parse(rss_xml)
self.ref_and_tags = add_new_references_from_feedparser_entries(web_feed,
f1.entries)

Expand Down
2 changes: 1 addition & 1 deletion wom_river/utils/read_opml.py
Expand Up @@ -51,7 +51,7 @@ def __init__(self):
self.tags = set()

def __str__(self):
return "Feed: %s\n- %s\n- %s\n- %s" % (self.title.encode("utf-8"),self.xmlUrl,self.htmlUrl,",".join(self.tags))
return "Feed: %s\n- %s\n- %s\n- %s" % (self.title,self.xmlUrl,self.htmlUrl,",".join(self.tags))

def warning(txt):
print("WARNING: " + txt)
Expand Down
4 changes: 2 additions & 2 deletions wom_tributary/models.py
Expand Up @@ -47,7 +47,7 @@ class GeneratedFeed(models.Model):
)

# Reference considered as the source
source = models.ForeignKey(Reference)
source = models.ForeignKey(Reference, on_delete=models.CASCADE)

# Date marking the last time the source was checked for an update
last_update_check = models.DateTimeField('last update')
Expand All @@ -71,7 +71,7 @@ class TwitterTimeline(models.Model):
SOURCE_URL = "https://twitter.com"
SOURCE_NAME = "Twitter"

generated_feed = models.OneToOneField(GeneratedFeed)
generated_feed = models.OneToOneField(GeneratedFeed, on_delete=models.CASCADE)

# User for which these tweets should be looked up
# NOTE: in current use case this user will be requested to
Expand Down

0 comments on commit dee041d

Please sign in to comment.