From 07d186d22820fabffc99bd50d1416097fa73c790 Mon Sep 17 00:00:00 2001 From: pulsar17 <5243241-pulsar17@users.noreply.gitlab.com> Date: Mon, 16 Aug 2021 19:23:53 +0530 Subject: [PATCH 01/19] Add on_delete kwarg to ForeignKey for Django 2.0 compatibility --- calendars/models.py | 10 +++++----- cmsplugin_image/models.py | 2 +- cmstabs/models.py | 16 ++++++++-------- forums/models.py | 2 +- person/models.py | 5 +++-- releases/models.py | 2 +- resources/models.py | 9 +++++---- 7 files changed, 24 insertions(+), 22 deletions(-) diff --git a/calendars/models.py b/calendars/models.py index 9bb223e1..e582a496 100644 --- a/calendars/models.py +++ b/calendars/models.py @@ -25,7 +25,7 @@ from datetime import timedelta from django.utils.translation import ugettext_lazy as _ from django.db.models import ( Model, Manager, QuerySet, TextField, CharField, URLField, BooleanField, - DateTimeField, ForeignKey + DateTimeField, ForeignKey, SET_NULL, CASCADE ) from django.utils.timezone import now from django.dispatch import receiver @@ -64,9 +64,9 @@ class EventQuerySet(QuerySet): class Event(Model): """A single event""" - team = ForeignKey(Team, related_name='events') - creator = ForeignKey(User, related_name='created_team_events') - + team = ForeignKey(Team, on_delete=SET_NULL, related_name='events', null=True) + creator = ForeignKey(User, on_delete=SET_NULL, related_name='created_team_events', + null=True) title = CharField(max_length=255) description = TextField(validators=[MaxLengthValidator(4096)]) recurrences = RecurrenceField(null=True, blank=True) @@ -137,7 +137,7 @@ class ExceptionQuerySet(QuerySet): class EventException(Model): """A single exception to a regular event""" - event = ForeignKey(Event, related_name='exceptions') + event = ForeignKey(Event, on_delete=CASCADE, related_name='exceptions') old_start = DateTimeField() new_start = DateTimeField(null=True, blank=True) diff --git a/cmsplugin_image/models.py b/cmsplugin_image/models.py index b23178a7..785d8278 100644 --- a/cmsplugin_image/models.py +++ b/cmsplugin_image/models.py @@ -40,7 +40,7 @@ class Image(CMSPlugin): help_text=_("If present, clicking on image will take user to link.")) page_link = ForeignKey( - Page, verbose_name=_("CMS page link"), null=True, + Page, on_delete=SET_NULL, verbose_name=_("CMS page link"), null=True, limit_choices_to={'publisher_is_draft': True}, blank=True, help_text=_("If present, clicking on image will take user to " "specified cms page.")) diff --git a/cmstabs/models.py b/cmstabs/models.py index 1c22e29d..7f08b8b3 100644 --- a/cmstabs/models.py +++ b/cmstabs/models.py @@ -27,7 +27,7 @@ import sys from django.conf import settings from django.db.models import ( Model, ForeignKey, CharField, IntegerField, FileField, URLField, - BooleanField, TextField, AutoField, SET_NULL, + BooleanField, TextField, AutoField, SET_NULL, CASCADE ) from django.utils.translation import ugettext_lazy as _ from django.utils.text import slugify @@ -65,15 +65,15 @@ class Tab(Model): """ link = URLField(_('External Link'), **null) name = CharField(max_length=64) - user = ForeignKey(settings.AUTH_USER_MODEL, related_name='front_tabs', **null) + user = ForeignKey(settings.AUTH_USER_MODEL, on_delete=SET_NULL, related_name='front_tabs', **null) download = FileField(_('Background'), upload_to='shields/backgrounds') - license = ForeignKey(License) + license = ForeignKey(License, on_delete=SET_NULL, null=True) order = IntegerField(editable=True, **null) tab_name = CharField(_("Heading"), max_length=64) tab_text = CharField(_("Sub-Heading"), max_length=128) - tab_cat = ForeignKey(TabCategory, verbose_name=_("Tab Icon")) + tab_cat = ForeignKey(TabCategory, on_delete=CASCADE ,verbose_name=_("Tab Icon")) banner_text = CharField(max_length=255, **null) banner_foot = CharField(max_length=128, **null) @@ -83,7 +83,7 @@ class Tab(Model): btn_icon = CharField(_("Button Icon"), max_length=12, choices=BTNS, **null) # The backwards linking here is because django can't inline ManyToMany fields - shield = ForeignKey('ShieldPlugin', related_name='tabs') + shield = ForeignKey('ShieldPlugin', on_delete=CASCADE, related_name='tabs') draft = ForeignKey('self', on_delete=SET_NULL, **null) is_visible = BooleanField(default=True) @@ -174,7 +174,7 @@ class GroupPhotoPlugin(CMSPlugin): ('3', _('Link Only Sponsors')), ) - source = ForeignKey(Group) + source = ForeignKey(Group, on_delete=CASCADE) style = CharField(_('Display Style'), max_length=1, choices=STYLES) class Meta: @@ -191,6 +191,6 @@ class TeamPlugin(CMSPlugin): ('small_horz', _('Links Only')), ) - team = ForeignKey(Team) - role = ForeignKey(MembershipRole, help_text='Limit to just this role.', **null) + team = ForeignKey(Team, on_delete=CASCADE) + role = ForeignKey(MembershipRole, on_delete=SET_NULL, help_text='Limit to just this role.', **null) template = CharField(max_length=32, default='small_horz', choices=TEMPLATES) diff --git a/forums/models.py b/forums/models.py index 68ef7d2e..7b4d8811 100644 --- a/forums/models.py +++ b/forums/models.py @@ -417,7 +417,7 @@ class BannedWords(Model): """ If these words/phrases are used, then the poster can be instantly banned. """ - moderator = ForeignKey(settings.AUTH_USER_MODEL, null=True, blank=True) + moderator = ForeignKey(settings.AUTH_USER_MODEL, on_delete=SET_NULL ,null=True, blank=True) created = DateTimeField(auto_now_add=True, null=True, blank=True) phrase = CharField(max_length=32, unique=True) in_title = BooleanField(default=True,\ diff --git a/person/models.py b/person/models.py index acc1b063..2b8825a4 100644 --- a/person/models.py +++ b/person/models.py @@ -269,8 +269,9 @@ class SocialMediaSite(Model): class UserSocialMedia(Model): """Link users to social media sites""" - site = ForeignKey(SocialMediaSite, related_name='users') - user = ForeignKey(User, related_name='social_media_urls') + site = ForeignKey(SocialMediaSite, on_delete=SET_NULL, + related_name='users,', null=True) + user = ForeignKey(User, on_delete=CASCADE, related_name='social_media_urls') socid = CharField(_("Username on Website"), max_length=128) url = property(lambda self: self.site.get_url(self.socid)) diff --git a/releases/models.py b/releases/models.py index 275b2d19..3a18955b 100644 --- a/releases/models.py +++ b/releases/models.py @@ -197,7 +197,7 @@ class ReleaseFile(Model): disk_file = FileField(upload_to=os.path.join('release', 'media')) original_url = URLField(unique=True, max_length=500, db_index=True) - first_seen = ForeignKey(Release, related_name='auto_media', **null) + first_seen = ForeignKey(Release, on_delete=CASCADE, related_name='auto_media', **null) uploaded_by = ForeignKey(User, on_delete=SET_NULL, **null) def __str__(self): diff --git a/resources/models.py b/resources/models.py index f345bdc7..b1cd2aef 100644 --- a/resources/models.py +++ b/resources/models.py @@ -30,7 +30,7 @@ from django.db.models import ( ForeignKey, ManyToManyField, OneToOneField, CharField, SlugField, TextField, BooleanField, URLField, FileField, IntegerField, DateTimeField, DateField, PositiveIntegerField, PositiveSmallIntegerField, - SET_NULL, CASCADE, + SET_NULL, CASCADE, SET_DEFAULT ) from django.conf import settings from django.urls import reverse @@ -860,7 +860,8 @@ class MirrorQuerySet(QuerySet): class ResourceMirror(Model): uuid = CharField(_("Unique Identifier"), max_length=64, default=uuid4) name = CharField(max_length=64) - manager = ForeignKey(settings.AUTH_USER_MODEL, default=get_user) + manager = ForeignKey(settings.AUTH_USER_MODEL, on_delete=SET_DEFAULT, + default=get_user) url = URLField(_("Full Base URL")) capacity = PositiveIntegerField(_("Capacity (MB/s)")) created = DateTimeField(default=now) @@ -1143,14 +1144,14 @@ ORDERS = ( class GalleryPlugin(CMSPlugin): limit = PositiveIntegerField(_('Number of items per page')) - source = ForeignKey(Gallery) + source = ForeignKey(Gallery, on_delete=CASCADE) display = CharField(_("Display Style"), max_length=32, choices=DISPLAYS, **NULL) order = CharField(_("Sort Order"), max_length=32, choices=ORDERS, **NULL) class CategoryPlugin(CMSPlugin): limit = PositiveIntegerField(_('Number of items per page')) - source = ForeignKey(Category) + source = ForeignKey(Category, on_delete=CASCADE) display = CharField(_("Display Style"), max_length=32, choices=DISPLAYS, **NULL) order = CharField(_("Sort Order"), max_length=32, choices=ORDERS, **NULL) -- GitLab From 6f0b985469f6f12d3b580701890bbd7680acfc75 Mon Sep 17 00:00:00 2001 From: pulsar17 <5243241-pulsar17@users.noreply.gitlab.com> Date: Mon, 16 Aug 2021 22:19:31 +0530 Subject: [PATCH 02/19] Fix removed import --- cmsplugin_news/feeds.py | 2 +- cmsplugin_news/menu.py | 2 +- cmsplugin_news/mixins.py | 2 +- cmsplugin_news/models.py | 2 +- cmstabs/cms_toolbar_objects.py | 2 +- cog/models.py | 2 +- cog/views.py | 2 +- forums/rss.py | 2 +- forums/views.py | 2 +- inkscape/testlib.py | 2 +- moderation/mixins.py | 2 +- moderation/templatetags/moderator.py | 2 +- moderation/views.py | 2 +- utils/reset_password_url.py | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cmsplugin_news/feeds.py b/cmsplugin_news/feeds.py index 0e880c9f..8227d836 100644 --- a/cmsplugin_news/feeds.py +++ b/cmsplugin_news/feeds.py @@ -19,7 +19,7 @@ # from django.contrib.syndication.views import Feed -from django.core.urlresolvers import reverse +from django.urls import reverse from django.utils.translation import get_language from django.utils.encoding import force_text diff --git a/cmsplugin_news/menu.py b/cmsplugin_news/menu.py index 32d11f55..26e9c4bf 100644 --- a/cmsplugin_news/menu.py +++ b/cmsplugin_news/menu.py @@ -23,7 +23,7 @@ This module hooks into django-cms' menu system by providing a clear menu hierarchy for every news item. """ from django.utils.translation import ugettext_lazy as _ -from django.core.urlresolvers import reverse +from django.urls import reverse from menus.menu_pool import menu_pool from menus.base import NavigationNode diff --git a/cmsplugin_news/mixins.py b/cmsplugin_news/mixins.py index 43ff9687..77c2229e 100644 --- a/cmsplugin_news/mixins.py +++ b/cmsplugin_news/mixins.py @@ -25,7 +25,7 @@ Provide news mixins from datetime import date from django.utils.translation import ugettext_lazy as _ -from django.core.urlresolvers import reverse +from django.urls import reverse from django.utils import dateformat from django.utils.decorators import method_decorator diff --git a/cmsplugin_news/models.py b/cmsplugin_news/models.py index f4c95054..2edce910 100644 --- a/cmsplugin_news/models.py +++ b/cmsplugin_news/models.py @@ -24,7 +24,7 @@ from django.db.models import Model, Manager,\ ImageField, FileField, URLField, PositiveIntegerField, SET_NULL, CASCADE from django.utils.translation import ugettext_lazy as _ from django.contrib.auth.models import Group -from django.core.urlresolvers import reverse +from django.urls import reverse from django.conf import settings from django.utils import timezone diff --git a/cmstabs/cms_toolbar_objects.py b/cmstabs/cms_toolbar_objects.py index e55b6276..135ed932 100644 --- a/cmstabs/cms_toolbar_objects.py +++ b/cmstabs/cms_toolbar_objects.py @@ -20,7 +20,7 @@ Provide django cms with object editing toolbar. from django.db.models import QuerySet, Model -from django.core.urlresolvers import NoReverseMatch, reverse +from django.urls import NoReverseMatch, reverse from django.utils.translation import ugettext_lazy as _, get_language_from_path from django.urls import translate_url from django.contrib.contenttypes.models import ContentType diff --git a/cog/models.py b/cog/models.py index 69e37df8..97d6cc43 100644 --- a/cog/models.py +++ b/cog/models.py @@ -23,7 +23,7 @@ Utility models which store data for the whole website's use. import json from django.conf import settings -from django.core.urlresolvers import reverse +from django.urls import reverse from django.db.models import ( Model, CharField, IntegerField, DateTimeField, TextField, URLField, PositiveIntegerField ) diff --git a/cog/views.py b/cog/views.py index 2371ab65..6e02ec51 100644 --- a/cog/views.py +++ b/cog/views.py @@ -30,7 +30,7 @@ from django.utils.translation import ugettext_lazy as _ from django.views.generic import ListView, DetailView, TemplateView from django.views.generic.base import RedirectView from django.views.generic.detail import SingleObjectMixin -from django.core.urlresolvers import reverse +from django.urls import reverse from django.utils.timezone import now from django.conf import settings diff --git a/forums/rss.py b/forums/rss.py index 89278c75..4bfdcb05 100644 --- a/forums/rss.py +++ b/forums/rss.py @@ -24,7 +24,7 @@ All views required to show a list of forum topics. from django.utils.translation import ugettext_lazy as _ from django.contrib.syndication.views import Feed -from django.core.urlresolvers import reverse +from django.urls import reverse from .models import Forum, ForumTopic diff --git a/forums/views.py b/forums/views.py index 2321987b..56985e3c 100644 --- a/forums/views.py +++ b/forums/views.py @@ -33,7 +33,7 @@ from django.contrib.auth.models import Permission from django.utils.translation import ugettext_lazy as _ from django.utils.timezone import make_aware from django.shortcuts import get_object_or_404 -from django.core.urlresolvers import reverse +from django.urls import reverse from django_comments.models import CommentFlag diff --git a/inkscape/testlib.py b/inkscape/testlib.py index ad5789df..2125c008 100644 --- a/inkscape/testlib.py +++ b/inkscape/testlib.py @@ -44,7 +44,7 @@ from django.test import TestCase from django.test.utils import override_settings from django.db.models import Model -from django.core.urlresolvers import reverse +from django.urls import reverse from django.core.management import call_command from django.core.files.base import File from django.conf import settings diff --git a/moderation/mixins.py b/moderation/mixins.py index ba8432fd..c92ba580 100644 --- a/moderation/mixins.py +++ b/moderation/mixins.py @@ -26,7 +26,7 @@ from django.contrib.contenttypes.models import ContentType from django.contrib.auth.decorators import login_required, permission_required from django.utils.translation import ugettext_lazy as _ from django.utils.decorators import method_decorator -from django.core.urlresolvers import reverse +from django.urls import reverse from django.shortcuts import get_object_or_404, redirect from django.views.generic import DetailView from django.http import JsonResponse diff --git a/moderation/templatetags/moderator.py b/moderation/templatetags/moderator.py index b5cf5f4e..b3ea4502 100644 --- a/moderation/templatetags/moderator.py +++ b/moderation/templatetags/moderator.py @@ -21,7 +21,7 @@ Provide a tool for getting moderation urls. """ -from django.core.urlresolvers import reverse +from django.urls import reverse from django.template import Library from django.conf import settings diff --git a/moderation/views.py b/moderation/views.py index 2c05411f..df69217b 100644 --- a/moderation/views.py +++ b/moderation/views.py @@ -24,7 +24,7 @@ from datetime import timedelta from django.db import utils from django.utils.translation import ugettext_lazy as _ from django.views.generic import TemplateView, ListView -from django.core.urlresolvers import reverse +from django.urls import reverse from .models import * from .mixins import * diff --git a/utils/reset_password_url.py b/utils/reset_password_url.py index ba4fa74a..b251eb98 100644 --- a/utils/reset_password_url.py +++ b/utils/reset_password_url.py @@ -22,7 +22,7 @@ except ImportError as err: from django.contrib.auth.tokens import default_token_generator from django.utils.http import urlsafe_base64_encode from django.utils.encoding import force_bytes -from django.core.urlresolvers import reverse +from django.urls import reverse from django.contrib.sites.models import Site from person.models import User -- GitLab From 9a67187c767081904b98b270342d701bedbf889e Mon Sep 17 00:00:00 2001 From: pulsar17 <5243241-pulsar17@users.noreply.gitlab.com> Date: Mon, 16 Aug 2021 22:19:56 +0530 Subject: [PATCH 03/19] Fix Geoip import --- cmstabs/templatetags/user_session.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmstabs/templatetags/user_session.py b/cmstabs/templatetags/user_session.py index 3bada661..99f53733 100644 --- a/cmstabs/templatetags/user_session.py +++ b/cmstabs/templatetags/user_session.py @@ -25,7 +25,7 @@ import re import warnings from django import template -from django.contrib.gis.geoip import HAS_GEOIP +from django.contrib.gis.geoip2 import HAS_GEOIP2 from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _, ugettext @@ -110,7 +110,7 @@ _geoip = None def geoip(): global _geoip - if _geoip is None and HAS_GEOIP: + if _geoip is None and HAS_GEOIP2: from django.contrib.gis.geoip import GeoIP try: _geoip = GeoIP() -- GitLab From 3bf2f6e20f04d228df9ffedf9d78020e38a5ccf9 Mon Sep 17 00:00:00 2001 From: pulsar17 <5243241-pulsar17@users.noreply.gitlab.com> Date: Tue, 17 Aug 2021 01:34:48 +0530 Subject: [PATCH 04/19] Add on_delete kwarg in Migrations for Django 2.0 compatibility --- cmsplugin_image/migrations/0001_initial.py | 2 +- cmsplugin_image/migrations/0005_auto_20180504_2002.py | 2 +- cmsplugin_news/migrations/0001_initial.py | 2 +- cmsplugin_news/migrations/0007_auto_20170614_2059.py | 2 +- cmsplugin_toc/migrations/0001_initial.py | 2 +- cmstabs/migrations/0001_initial.py | 4 ++-- cmstabs/migrations/0002_add_inlinepages.py | 4 ++-- cmstabs/migrations/0004_auto_20180324_1620.py | 8 ++++---- forums/migrations/0005_auto_20160915_1734.py | 2 +- person/migrations/0001_initial.py | 4 ++-- person/migrations/0003_auto_20160122_0915.py | 2 +- person/migrations/0017_auto_20170814_0703.py | 2 +- resources/migrations/0001_initial.py | 4 ++-- resources/migrations/0036_auto_20170316_1158.py | 4 ++-- 14 files changed, 22 insertions(+), 22 deletions(-) diff --git a/cmsplugin_image/migrations/0001_initial.py b/cmsplugin_image/migrations/0001_initial.py index 97884875..a7e401bb 100644 --- a/cmsplugin_image/migrations/0001_initial.py +++ b/cmsplugin_image/migrations/0001_initial.py @@ -16,7 +16,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Image', fields=[ - ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=False, serialize=False, to='cms.CMSPlugin')), + ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=False, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE)), ('image', models.ImageField(upload_to=cms.models.pluginmodel.get_plugin_media_path, verbose_name='image', max_length=200)), ('url', models.CharField(help_text='If present, clicking on image will take user to link.', max_length=255, null=True, verbose_name='Link', blank=True)), ('page_link', models.ForeignKey(blank=True, to='cms.Page', help_text='If present, clicking on image will take user to specified cms page.', null=True, verbose_name='CMS page link', on_delete=models.CASCADE)), diff --git a/cmsplugin_image/migrations/0005_auto_20180504_2002.py b/cmsplugin_image/migrations/0005_auto_20180504_2002.py index a57257f2..8bc0e01c 100644 --- a/cmsplugin_image/migrations/0005_auto_20180504_2002.py +++ b/cmsplugin_image/migrations/0005_auto_20180504_2002.py @@ -19,6 +19,6 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='image', name='cmsplugin_ptr', - field=models.OneToOneField(parent_link=True, related_name='cmsplugin_image_image', auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin'), + field=models.OneToOneField(parent_link=True, related_name='cmsplugin_image_image', auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE), ), ] diff --git a/cmsplugin_news/migrations/0001_initial.py b/cmsplugin_news/migrations/0001_initial.py index 36381abe..f211ddec 100644 --- a/cmsplugin_news/migrations/0001_initial.py +++ b/cmsplugin_news/migrations/0001_initial.py @@ -18,7 +18,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='LatestNewsPlugin', fields=[ - ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')), + ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE)), ('limit', models.PositiveIntegerField(help_text='Limits the number of items that will be displayed', verbose_name='Number of news items to show')), ], options={ diff --git a/cmsplugin_news/migrations/0007_auto_20170614_2059.py b/cmsplugin_news/migrations/0007_auto_20170614_2059.py index 14a1517a..abce0e42 100644 --- a/cmsplugin_news/migrations/0007_auto_20170614_2059.py +++ b/cmsplugin_news/migrations/0007_auto_20170614_2059.py @@ -41,7 +41,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='latestnewsplugin', name='cmsplugin_ptr', - field=models.OneToOneField(parent_link=True, related_name='cmsplugin_news_latestnewsplugin', auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin'), + field=models.OneToOneField(parent_link=True, related_name='cmsplugin_news_latestnewsplugin', auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE), ), migrations.AddField( model_name='newsbacklink', diff --git a/cmsplugin_toc/migrations/0001_initial.py b/cmsplugin_toc/migrations/0001_initial.py index 4693314f..d473d2e0 100644 --- a/cmsplugin_toc/migrations/0001_initial.py +++ b/cmsplugin_toc/migrations/0001_initial.py @@ -14,7 +14,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='TableOfContents', fields=[ - ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')), + ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE)), ('title', models.CharField(max_length=128, verbose_name='Title')), ('bullet', models.BooleanField(default=False, verbose_name='Use Bullets')), ], diff --git a/cmstabs/migrations/0001_initial.py b/cmstabs/migrations/0001_initial.py index ba46015a..fa51e5fc 100644 --- a/cmstabs/migrations/0001_initial.py +++ b/cmstabs/migrations/0001_initial.py @@ -18,7 +18,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='ShieldPlugin', fields=[ - ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')), + ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE)), ], options={ 'db_table': 'extra_shieldplugin', @@ -77,7 +77,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='GroupPhotoPlugin', fields=[ - ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')), + ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE)), ('style', models.CharField(max_length=1, verbose_name='Display Style', choices=[('L', 'Simple List'), ('P', 'Photo Heads'), ('B', 'Photo Bios')])), ('source', models.ForeignKey(to='auth.Group', on_delete=models.CASCADE)), ], diff --git a/cmstabs/migrations/0002_add_inlinepages.py b/cmstabs/migrations/0002_add_inlinepages.py index 34ac5484..e26ee8a0 100644 --- a/cmstabs/migrations/0002_add_inlinepages.py +++ b/cmstabs/migrations/0002_add_inlinepages.py @@ -15,7 +15,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='InlinePage', fields=[ - ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')), + ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE)), ('title', models.CharField(max_length=64)), ], options={ @@ -26,7 +26,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='InlinePages', fields=[ - ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')), + ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE)), ], options={ 'db_table': 'extra_inlinepages', diff --git a/cmstabs/migrations/0004_auto_20180324_1620.py b/cmstabs/migrations/0004_auto_20180324_1620.py index d527a7f5..d89215ff 100644 --- a/cmstabs/migrations/0004_auto_20180324_1620.py +++ b/cmstabs/migrations/0004_auto_20180324_1620.py @@ -15,7 +15,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='groupphotoplugin', name='cmsplugin_ptr', - field=models.OneToOneField(parent_link=True, related_name='cmstabs_groupphotoplugin', auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin'), + field=models.OneToOneField(parent_link=True, related_name='cmstabs_groupphotoplugin', auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE), ), migrations.AlterField( model_name='groupphotoplugin', @@ -25,17 +25,17 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='inlinepage', name='cmsplugin_ptr', - field=models.OneToOneField(parent_link=True, related_name='cmstabs_inlinepage', auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin'), + field=models.OneToOneField(parent_link=True, related_name='cmstabs_inlinepage', auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE), ), migrations.AlterField( model_name='inlinepages', name='cmsplugin_ptr', - field=models.OneToOneField(parent_link=True, related_name='cmstabs_inlinepages', auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin'), + field=models.OneToOneField(parent_link=True, related_name='cmstabs_inlinepages', auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete= models.CASCADE), ), migrations.AlterField( model_name='shieldplugin', name='cmsplugin_ptr', - field=models.OneToOneField(parent_link=True, related_name='cmstabs_shieldplugin', auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin'), + field=models.OneToOneField(parent_link=True, related_name='cmstabs_shieldplugin', auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE), ), migrations.AlterField( model_name='tabcategory', diff --git a/forums/migrations/0005_auto_20160915_1734.py b/forums/migrations/0005_auto_20160915_1734.py index 5c78c8be..1a6b5691 100644 --- a/forums/migrations/0005_auto_20160915_1734.py +++ b/forums/migrations/0005_auto_20160915_1734.py @@ -20,7 +20,7 @@ class Migration(migrations.Migration): ('reply_id', models.CharField(help_text='Either the previous message in the chain, or the parent id', max_length=255, null=True, db_index=True, blank=True)), ('subject', models.CharField(help_text='A matchable subject line for this comment.', max_length=255, null=True, db_index=True, blank=True)), ('extra_data', models.TextField(null=True, blank=True)), - ('comment', models.OneToOneField(related_name='link', to='django_comments.Comment')), + ('comment', models.OneToOneField(related_name='link', to='django_comments.Comment', on_delete=models.CASCADE)), ], ), migrations.AddField( diff --git a/person/migrations/0001_initial.py b/person/migrations/0001_initial.py index b76fa3ae..2a88d453 100644 --- a/person/migrations/0001_initial.py +++ b/person/migrations/0001_initial.py @@ -43,7 +43,7 @@ class Migration(migrations.Migration): ('name', models.CharField(max_length=32, verbose_name='User Team')), ('icon', models.ImageField(upload_to='teams', verbose_name='Display Icon')), ('desc', models.TextField(blank=True, null=True, verbose_name='Full Description', validators=[django.core.validators.MaxLengthValidator(10240)])), - ('group', models.OneToOneField(related_name='team', null=True, blank=True, to='auth.Group')), + ('group', models.OneToOneField(related_name='team', null=True, blank=True, to='auth.Group', on_delete=models.CASCADE)), ], options={ 'db_table': 'person_userroll', @@ -65,7 +65,7 @@ class Migration(migrations.Migration): ('gpg_key', models.TextField(blank=True, null=True, verbose_name='GPG Public Key', validators=[django.core.validators.MaxLengthValidator(262144)])), ('last_seen', models.DateTimeField(null=True, blank=True)), ('visits', models.IntegerField(default=0)), - ('user', models.OneToOneField(related_name='details', to=settings.AUTH_USER_MODEL)), + ('user', models.OneToOneField(related_name='details', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE)), ], options={ }, diff --git a/person/migrations/0003_auto_20160122_0915.py b/person/migrations/0003_auto_20160122_0915.py index 79fd2144..12b06821 100644 --- a/person/migrations/0003_auto_20160122_0915.py +++ b/person/migrations/0003_auto_20160122_0915.py @@ -86,7 +86,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='team', name='group', - field=models.OneToOneField(related_name='team', default=1, to='auth.Group'), + field=models.OneToOneField(related_name='team', default=1, to='auth.Group', on_delete=models.CASCADE), preserve_default=False, ), migrations.AlterField( diff --git a/person/migrations/0017_auto_20170814_0703.py b/person/migrations/0017_auto_20170814_0703.py index d883e73d..36739f5c 100644 --- a/person/migrations/0017_auto_20170814_0703.py +++ b/person/migrations/0017_auto_20170814_0703.py @@ -35,7 +35,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='team', name='group', - field=inkscape.fields.AutoOneToOneField(related_name='team', to='auth.Group'), + field=inkscape.fields.AutoOneToOneField(related_name='team', to='auth.Group', on_delete=models.CASCADE), ), migrations.AlterField( model_name='user', diff --git a/resources/migrations/0001_initial.py b/resources/migrations/0001_initial.py index 3712fe10..f226c2a7 100644 --- a/resources/migrations/0001_initial.py +++ b/resources/migrations/0001_initial.py @@ -31,7 +31,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='CategoryPlugin', fields=[ - ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')), + ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE)), ('limit', models.PositiveIntegerField(verbose_name='Number of items per page')), ('display', models.CharField(blank=True, max_length=32, null=True, verbose_name='Display Style', choices=[('list', 'Gallery List'), ('rows', 'Gallery Rows')])), ('source', models.ForeignKey(to='resources.Category', on_delete=models.CASCADE)), @@ -53,7 +53,7 @@ class Migration(migrations.Migration): migrations.CreateModel( name='GalleryPlugin', fields=[ - ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin')), + ('cmsplugin_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE)), ('limit', models.PositiveIntegerField(verbose_name='Number of items per page')), ('display', models.CharField(blank=True, max_length=32, null=True, verbose_name='Display Style', choices=[('list', 'Gallery List'), ('rows', 'Gallery Rows')])), ('source', models.ForeignKey(to='resources.Gallery', on_delete=models.CASCADE)), diff --git a/resources/migrations/0036_auto_20170316_1158.py b/resources/migrations/0036_auto_20170316_1158.py index 9633f15a..48f177b8 100644 --- a/resources/migrations/0036_auto_20170316_1158.py +++ b/resources/migrations/0036_auto_20170316_1158.py @@ -15,12 +15,12 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='categoryplugin', name='cmsplugin_ptr', - field=models.OneToOneField(parent_link=True, related_name='resources_categoryplugin', auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin'), + field=models.OneToOneField(parent_link=True, related_name='resources_categoryplugin', auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE), ), migrations.AlterField( model_name='galleryplugin', name='cmsplugin_ptr', - field=models.OneToOneField(parent_link=True, related_name='resources_galleryplugin', auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin'), + field=models.OneToOneField(parent_link=True, related_name='resources_galleryplugin', auto_created=True, primary_key=True, serialize=False, to='cms.CMSPlugin', on_delete=models.CASCADE), ), migrations.AlterField( model_name='resource', -- GitLab From 3ff1da83a400c2339c23faa58688a43532cd375b Mon Sep 17 00:00:00 2001 From: pulsar17 <5243241-pulsar17@users.noreply.gitlab.com> Date: Tue, 17 Aug 2021 02:01:06 +0530 Subject: [PATCH 05/19] Fix url includes for Django 2.0 compatibility --- calendars/urls.py | 2 ++ cmsplugin_news/urls.py | 2 ++ cog/urls.py | 2 ++ elections/urls.py | 2 ++ forums/urls.py | 2 ++ inkscape/urls.py | 16 ++++++++-------- moderation/urls.py | 2 ++ person/team_urls.py | 2 +- releases/urls.py | 2 ++ 9 files changed, 23 insertions(+), 9 deletions(-) diff --git a/calendars/urls.py b/calendars/urls.py index c43f37c4..0ff16080 100644 --- a/calendars/urls.py +++ b/calendars/urls.py @@ -26,6 +26,8 @@ from person import user_urls, team_urls from .views import EventList, TeamEventFeed, TeamEvent, TeamEventList +app_name = 'calendars' + team_urls.urlpatterns += [ url(r'^calendar.ics$', TeamEventFeed(), name='team_calendar_feed'), url(r'^calendar/$', TeamEventList.as_view(), name='team_calendar'), diff --git a/cmsplugin_news/urls.py b/cmsplugin_news/urls.py index d3bc4d0f..161fdfc1 100644 --- a/cmsplugin_news/urls.py +++ b/cmsplugin_news/urls.py @@ -28,6 +28,8 @@ from .views import ( DetailView, DetailNews, UploadMedia, ) +app_name = 'news' + urlpatterns = [ # pylint: disable=invalid-name url(r'^$', ArchiveIndexView.as_view(), name='archive_index'), url(r'^unpublished/(?P\d+)/$', DetailNews.as_view(), name="item"), diff --git a/cog/urls.py b/cog/urls.py index 4c4396b7..cac4b200 100644 --- a/cog/urls.py +++ b/cog/urls.py @@ -23,6 +23,8 @@ from django.conf.urls import url from .views import ErrorList, ErrorDetail, MarkFixed, WebsiteStats +app_name = 'cog' + urlpatterns = [ url(r'^errors/$', ErrorList.as_view(), name='errors'), url(r'^errors/(?P[^\/]*)/$', ErrorDetail.as_view(), name='error'), diff --git a/elections/urls.py b/elections/urls.py index 6b9e9d0b..444c27a1 100644 --- a/elections/urls.py +++ b/elections/urls.py @@ -28,6 +28,8 @@ from .views import ( ElectionInviteMessage, ElectionVote ) +app_name = 'elections' + urlpatterns = [ # pylint: disable=invalid-name url(r'^$', ElectionList.as_view(), name='list'), url_tree( diff --git a/forums/urls.py b/forums/urls.py index db3c7211..896dc4a8 100644 --- a/forums/urls.py +++ b/forums/urls.py @@ -39,6 +39,8 @@ from .rss import ForumTopicFeed from .search_views import CommentSearch, TopicSearch, TopicSubjectSearch +app_name = 'forums' + user_urls.urlpatterns += [ url(r'^comments/$', CommentList.as_view(), name="comment_list"), url(r'^topics/$', UserTopicList.as_view(), name="topic_list"), diff --git a/inkscape/urls.py b/inkscape/urls.py index a9af6d5b..09866563 100644 --- a/inkscape/urls.py +++ b/inkscape/urls.py @@ -51,16 +51,16 @@ urlpatterns += i18n_patterns( url(r'^search/$', SearchView(), name='search'), url(r'^search/json/$', SearchJson(), name='search.json'), url(r'^credits/$', Authors.as_view(), name='authors'), - url(r'^admin/', include(admin.site.urls)), - url(r'^cog/', include('cog.urls', namespace='cog')), - url(r'^forums/', include('forums.urls', namespace='forums')), - url(r'^cals/', include('calendars.urls', namespace='calendars')), - url(r'^releases?/', include('releases.urls', namespace='releases')), + url(r'^admin/', admin.site.urls), + url(r'^cog/', include('cog.urls')), + url(r'^forums/', include('forums.urls')), + url(r'^cals/', include('calendars.urls')), + url(r'^releases?/', include('releases.urls')), url(r'^alerts/', include('alerts.urls')), url(r'^comments/', include('django_comments.urls')), - url(r'^moderation/', include('moderation.urls', namespace='moderation')), - url(r'^news/', include('cmsplugin_news.urls', namespace='news')), - url(r'^diff/', include('cmsplugin_diff.urls', namespace='cmsplugin_diff')), + url(r'^moderation/', include('moderation.urls')), + url(r'^news/', include('cmsplugin_news.urls')), + url(r'^diff/', include('cmsplugin_diff.urls')), url(r'^doc/', include('docs.urls')), url(r'^~(?P[^\/]+)/', include('person.user_urls')), url(r'^\*(?P[^\/]+)/', include('person.team_urls')), diff --git a/moderation/urls.py b/moderation/urls.py index f22eba08..fcf521dc 100644 --- a/moderation/urls.py +++ b/moderation/urls.py @@ -27,6 +27,8 @@ from .views import ( ApproveObject, NoteObject, ) +app_name = 'moderation' + urlpatterns = [ # pylint: disable=invalid-name url(r'^$', Moderation.as_view(), name="index"), url_tree( diff --git a/person/team_urls.py b/person/team_urls.py index dc5d31a1..80b13499 100644 --- a/person/team_urls.py +++ b/person/team_urls.py @@ -43,7 +43,7 @@ urlpatterns = [ # pylint: disable=invalid-name url(r'^membership/(?P\d+)/$', MembershipRequestView.as_view(), name='team.membership'), url(r'^charter/$', TeamCharter.as_view(), name='team.charter'), url(r'^list.txt$', TeamMemberList.as_view(), name='team.list'), - url(r'^elections/', include('elections.urls', namespace='elections')), + url(r'^elections/', include('elections.urls')), url(r'^chat/$', ChatWithTeam.as_view(), name='team.chat'), url_tree( diff --git a/releases/urls.py b/releases/urls.py index 7004d42e..2bbc63fa 100644 --- a/releases/urls.py +++ b/releases/urls.py @@ -26,6 +26,8 @@ from .views import DownloadRedirect, ReleaseView, PlatformList,\ ReleasePlatformStage, ReleasePlatformView, PlatformView,\ GitMergeRequestList +app_name = 'releases' + version_urls = url_tree( # pylint: disable=invalid-name r'^(?P[\w\+\.-]+)/', url('^$', ReleaseView.as_view(), name="release"), -- GitLab From 348902f42f30079db91b58a8052415be399e9a5b Mon Sep 17 00:00:00 2001 From: pulsar17 <5243241-pulsar17@users.noreply.gitlab.com> Date: Tue, 17 Aug 2021 02:01:25 +0530 Subject: [PATCH 06/19] Fix invalid related_name --- person/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/person/models.py b/person/models.py index 2b8825a4..956ff143 100644 --- a/person/models.py +++ b/person/models.py @@ -270,7 +270,7 @@ class SocialMediaSite(Model): class UserSocialMedia(Model): """Link users to social media sites""" site = ForeignKey(SocialMediaSite, on_delete=SET_NULL, - related_name='users,', null=True) + related_name='users', null=True) user = ForeignKey(User, on_delete=CASCADE, related_name='social_media_urls') socid = CharField(_("Username on Website"), max_length=128) -- GitLab From cd1903913c8ca11198f689acc870fa447c02c76f Mon Sep 17 00:00:00 2001 From: pulsar17 <5243241-pulsar17@users.noreply.gitlab.com> Date: Tue, 17 Aug 2021 23:52:13 +0530 Subject: [PATCH 07/19] Add Migrations for changed ForeignKeys and OneToOneFields --- .../migrations/0005_auto_20210817_1818.py | 25 ++++++++++++++ .../migrations/0006_auto_20210817_1818.py | 19 +++++++++++ .../migrations/0010_auto_20210817_1818.py | 18 ++++++++++ cmstabs/migrations/0007_auto_20210817_1818.py | 30 ++++++++++++++++ el_menu/migrations/0006_auto_20210817_1818.py | 23 +++++++++++++ .../migrations/0006_auto_20210817_1818.py | 19 +++++++++++ forums/migrations/0031_auto_20210817_1818.py | 20 +++++++++++ .../migrations/0007_auto_20210817_1818.py | 20 +++++++++++ person/migrations/0033_auto_20210817_1818.py | 34 +++++++++++++++++++ .../migrations/0031_auto_20210817_1818.py | 28 +++++++++++++++ .../migrations/0051_auto_20210817_1818.py | 21 ++++++++++++ stats/migrations/0004_auto_20210817_1818.py | 18 ++++++++++ 12 files changed, 275 insertions(+) create mode 100644 calendars/migrations/0005_auto_20210817_1818.py create mode 100644 cmsplugin_image/migrations/0006_auto_20210817_1818.py create mode 100644 cmsplugin_news/migrations/0010_auto_20210817_1818.py create mode 100644 cmstabs/migrations/0007_auto_20210817_1818.py create mode 100644 el_menu/migrations/0006_auto_20210817_1818.py create mode 100644 elections/migrations/0006_auto_20210817_1818.py create mode 100644 forums/migrations/0031_auto_20210817_1818.py create mode 100644 inkscape/migrations/0007_auto_20210817_1818.py create mode 100644 person/migrations/0033_auto_20210817_1818.py create mode 100644 releases/migrations/0031_auto_20210817_1818.py create mode 100644 resources/migrations/0051_auto_20210817_1818.py create mode 100644 stats/migrations/0004_auto_20210817_1818.py diff --git a/calendars/migrations/0005_auto_20210817_1818.py b/calendars/migrations/0005_auto_20210817_1818.py new file mode 100644 index 00000000..3e2cec2f --- /dev/null +++ b/calendars/migrations/0005_auto_20210817_1818.py @@ -0,0 +1,25 @@ +# Generated by Django 2.0 on 2021-08-17 18:18 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('calendars', '0004_eventexception'), + ] + + operations = [ + migrations.AlterField( + model_name='event', + name='creator', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='created_team_events', to=settings.AUTH_USER_MODEL), + ), + migrations.AlterField( + model_name='event', + name='team', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='events', to='person.Team'), + ), + ] diff --git a/cmsplugin_image/migrations/0006_auto_20210817_1818.py b/cmsplugin_image/migrations/0006_auto_20210817_1818.py new file mode 100644 index 00000000..575d620a --- /dev/null +++ b/cmsplugin_image/migrations/0006_auto_20210817_1818.py @@ -0,0 +1,19 @@ +# Generated by Django 2.0 on 2021-08-17 18:18 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('cmsplugin_image', '0005_auto_20180504_2002'), + ] + + operations = [ + migrations.AlterField( + model_name='image', + name='page_link', + field=models.ForeignKey(blank=True, help_text='If present, clicking on image will take user to specified cms page.', limit_choices_to={'publisher_is_draft': True}, null=True, on_delete=django.db.models.deletion.SET_NULL, to='cms.Page', verbose_name='CMS page link'), + ), + ] diff --git a/cmsplugin_news/migrations/0010_auto_20210817_1818.py b/cmsplugin_news/migrations/0010_auto_20210817_1818.py new file mode 100644 index 00000000..f5b72d1e --- /dev/null +++ b/cmsplugin_news/migrations/0010_auto_20210817_1818.py @@ -0,0 +1,18 @@ +# Generated by Django 2.0 on 2021-08-17 18:18 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('cmsplugin_news', '0009_newsmedia'), + ] + + operations = [ + migrations.AlterField( + model_name='news', + name='language', + field=models.CharField(choices=[('af', 'Afrikaans'), ('ar', 'Arabic'), ('ast', 'Asturian'), ('az', 'Azerbaijani'), ('bg', 'Bulgarian'), ('be', 'Belarusian'), ('bn', 'Bengali'), ('br', 'Breton'), ('bs', 'Bosnian'), ('ca', 'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'), ('de', 'German'), ('dsb', 'Lower Sorbian'), ('el', 'Greek'), ('eo', 'Esperanto'), ('es', 'Spanish'), ('es-ar', 'Argentinian Spanish'), ('es-co', 'Colombian Spanish'), ('es-mx', 'Mexican Spanish'), ('es-ni', 'Nicaraguan Spanish'), ('es-ve', 'Venezuelan Spanish'), ('et', 'Estonian'), ('eu', 'Basque'), ('fa', 'Persian'), ('fi', 'Finnish'), ('fr', 'French'), ('fy', 'Frisian'), ('ga', 'Irish'), ('gd', 'Scottish Gaelic'), ('gl', 'Galician'), ('he', 'Hebrew'), ('hi', 'Hindi'), ('hr', 'Croatian'), ('hsb', 'Upper Sorbian'), ('hu', 'Hungarian'), ('ia', 'Interlingua'), ('id', 'Indonesian'), ('io', 'Ido'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'), ('ka', 'Georgian'), ('kab', 'Kabyle'), ('kk', 'Kazakh'), ('km', 'Khmer'), ('kn', 'Kannada'), ('ko', 'Korean'), ('lb', 'Luxembourgish'), ('lt', 'Lithuanian'), ('lv', 'Latvian'), ('mk', 'Macedonian'), ('ml', 'Malayalam'), ('mn', 'Mongolian'), ('mr', 'Marathi'), ('my', 'Burmese'), ('nb', 'Norwegian Bokmål'), ('ne', 'Nepali'), ('nl', 'Dutch'), ('nn', 'Norwegian Nynorsk'), ('os', 'Ossetic'), ('pa', 'Punjabi'), ('pl', 'Polish'), ('pt', 'Portuguese'), ('pt-br', 'Brazilian Portuguese'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'), ('sq', 'Albanian'), ('sr', 'Serbian'), ('sr-latn', 'Serbian Latin'), ('sv', 'Swedish'), ('sw', 'Swahili'), ('ta', 'Tamil'), ('te', 'Telugu'), ('th', 'Thai'), ('tr', 'Turkish'), ('tt', 'Tatar'), ('udm', 'Udmurt'), ('uk', 'Ukrainian'), ('ur', 'Urdu'), ('vi', 'Vietnamese'), ('zh-hans', 'Simplified Chinese'), ('zh-hant', 'Traditional Chinese')], db_index=True, help_text='Translated version of another news item.', max_length=8, verbose_name='Language'), + ), + ] diff --git a/cmstabs/migrations/0007_auto_20210817_1818.py b/cmstabs/migrations/0007_auto_20210817_1818.py new file mode 100644 index 00000000..efc787b1 --- /dev/null +++ b/cmstabs/migrations/0007_auto_20210817_1818.py @@ -0,0 +1,30 @@ +# Generated by Django 2.0 on 2021-08-17 18:18 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('cmstabs', '0006_auto_20210517_1418'), + ] + + operations = [ + migrations.AlterField( + model_name='tab', + name='license', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='resources.License'), + ), + migrations.AlterField( + model_name='tab', + name='user', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='front_tabs', to=settings.AUTH_USER_MODEL), + ), + migrations.AlterField( + model_name='teamplugin', + name='role', + field=models.ForeignKey(blank=True, help_text='Limit to just this role.', null=True, on_delete=django.db.models.deletion.SET_NULL, to='person.MembershipRole'), + ), + ] diff --git a/el_menu/migrations/0006_auto_20210817_1818.py b/el_menu/migrations/0006_auto_20210817_1818.py new file mode 100644 index 00000000..22802ff2 --- /dev/null +++ b/el_menu/migrations/0006_auto_20210817_1818.py @@ -0,0 +1,23 @@ +# Generated by Django 2.0 on 2021-08-17 18:18 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('el_menu', '0005_auto_20200609_1139'), + ] + + operations = [ + migrations.AlterField( + model_name='menuitem', + name='lang', + field=models.CharField(choices=[('all', 'All Languages'), ('af', 'Afrikaans'), ('ar', 'Arabic'), ('ast', 'Asturian'), ('az', 'Azerbaijani'), ('bg', 'Bulgarian'), ('be', 'Belarusian'), ('bn', 'Bengali'), ('br', 'Breton'), ('bs', 'Bosnian'), ('ca', 'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'), ('de', 'German'), ('dsb', 'Lower Sorbian'), ('el', 'Greek'), ('en', 'English'), ('en-au', 'Australian English'), ('en-gb', 'British English'), ('eo', 'Esperanto'), ('es', 'Spanish'), ('es-ar', 'Argentinian Spanish'), ('es-co', 'Colombian Spanish'), ('es-mx', 'Mexican Spanish'), ('es-ni', 'Nicaraguan Spanish'), ('es-ve', 'Venezuelan Spanish'), ('et', 'Estonian'), ('eu', 'Basque'), ('fa', 'Persian'), ('fi', 'Finnish'), ('fr', 'French'), ('fy', 'Frisian'), ('ga', 'Irish'), ('gd', 'Scottish Gaelic'), ('gl', 'Galician'), ('he', 'Hebrew'), ('hi', 'Hindi'), ('hr', 'Croatian'), ('hsb', 'Upper Sorbian'), ('hu', 'Hungarian'), ('ia', 'Interlingua'), ('id', 'Indonesian'), ('io', 'Ido'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'), ('ka', 'Georgian'), ('kab', 'Kabyle'), ('kk', 'Kazakh'), ('km', 'Khmer'), ('kn', 'Kannada'), ('ko', 'Korean'), ('lb', 'Luxembourgish'), ('lt', 'Lithuanian'), ('lv', 'Latvian'), ('mk', 'Macedonian'), ('ml', 'Malayalam'), ('mn', 'Mongolian'), ('mr', 'Marathi'), ('my', 'Burmese'), ('nb', 'Norwegian Bokmål'), ('ne', 'Nepali'), ('nl', 'Dutch'), ('nn', 'Norwegian Nynorsk'), ('os', 'Ossetic'), ('pa', 'Punjabi'), ('pl', 'Polish'), ('pt', 'Portuguese'), ('pt-br', 'Brazilian Portuguese'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'), ('sq', 'Albanian'), ('sr', 'Serbian'), ('sr-latn', 'Serbian Latin'), ('sv', 'Swedish'), ('sw', 'Swahili'), ('ta', 'Tamil'), ('te', 'Telugu'), ('th', 'Thai'), ('tr', 'Turkish'), ('tt', 'Tatar'), ('udm', 'Udmurt'), ('uk', 'Ukrainian'), ('ur', 'Urdu'), ('vi', 'Vietnamese'), ('zh-hans', 'Simplified Chinese'), ('zh-hant', 'Traditional Chinese')], db_column='root_id', db_index=True, default='all', help_text='If set, this menu will only be available to this language. DO NOT use this for translations!', max_length=12), + ), + migrations.AlterField( + model_name='menutranslation', + name='language', + field=models.CharField(choices=[('af', 'Afrikaans'), ('ar', 'Arabic'), ('ast', 'Asturian'), ('az', 'Azerbaijani'), ('bg', 'Bulgarian'), ('be', 'Belarusian'), ('bn', 'Bengali'), ('br', 'Breton'), ('bs', 'Bosnian'), ('ca', 'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'), ('de', 'German'), ('dsb', 'Lower Sorbian'), ('el', 'Greek'), ('en', 'English'), ('en-au', 'Australian English'), ('en-gb', 'British English'), ('eo', 'Esperanto'), ('es', 'Spanish'), ('es-ar', 'Argentinian Spanish'), ('es-co', 'Colombian Spanish'), ('es-mx', 'Mexican Spanish'), ('es-ni', 'Nicaraguan Spanish'), ('es-ve', 'Venezuelan Spanish'), ('et', 'Estonian'), ('eu', 'Basque'), ('fa', 'Persian'), ('fi', 'Finnish'), ('fr', 'French'), ('fy', 'Frisian'), ('ga', 'Irish'), ('gd', 'Scottish Gaelic'), ('gl', 'Galician'), ('he', 'Hebrew'), ('hi', 'Hindi'), ('hr', 'Croatian'), ('hsb', 'Upper Sorbian'), ('hu', 'Hungarian'), ('ia', 'Interlingua'), ('id', 'Indonesian'), ('io', 'Ido'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'), ('ka', 'Georgian'), ('kab', 'Kabyle'), ('kk', 'Kazakh'), ('km', 'Khmer'), ('kn', 'Kannada'), ('ko', 'Korean'), ('lb', 'Luxembourgish'), ('lt', 'Lithuanian'), ('lv', 'Latvian'), ('mk', 'Macedonian'), ('ml', 'Malayalam'), ('mn', 'Mongolian'), ('mr', 'Marathi'), ('my', 'Burmese'), ('nb', 'Norwegian Bokmål'), ('ne', 'Nepali'), ('nl', 'Dutch'), ('nn', 'Norwegian Nynorsk'), ('os', 'Ossetic'), ('pa', 'Punjabi'), ('pl', 'Polish'), ('pt', 'Portuguese'), ('pt-br', 'Brazilian Portuguese'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'), ('sq', 'Albanian'), ('sr', 'Serbian'), ('sr-latn', 'Serbian Latin'), ('sv', 'Swedish'), ('sw', 'Swahili'), ('ta', 'Tamil'), ('te', 'Telugu'), ('th', 'Thai'), ('tr', 'Turkish'), ('tt', 'Tatar'), ('udm', 'Udmurt'), ('uk', 'Ukrainian'), ('ur', 'Urdu'), ('vi', 'Vietnamese'), ('zh-hans', 'Simplified Chinese'), ('zh-hant', 'Traditional Chinese')], db_index=True, max_length=12), + ), + ] diff --git a/elections/migrations/0006_auto_20210817_1818.py b/elections/migrations/0006_auto_20210817_1818.py new file mode 100644 index 00000000..ab95b84a --- /dev/null +++ b/elections/migrations/0006_auto_20210817_1818.py @@ -0,0 +1,19 @@ +# Generated by Django 2.0 on 2021-08-17 18:18 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('elections', '0005_auto_20200609_1139'), + ] + + operations = [ + migrations.AlterField( + model_name='vote', + name='candidate', + field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='votes', to='elections.Candidate'), + ), + ] diff --git a/forums/migrations/0031_auto_20210817_1818.py b/forums/migrations/0031_auto_20210817_1818.py new file mode 100644 index 00000000..693dc9d5 --- /dev/null +++ b/forums/migrations/0031_auto_20210817_1818.py @@ -0,0 +1,20 @@ +# Generated by Django 2.0 on 2021-08-17 18:18 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('forums', '0030_auto_20210705_2035'), + ] + + operations = [ + migrations.AlterField( + model_name='bannedwords', + name='moderator', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL), + ), + ] diff --git a/inkscape/migrations/0007_auto_20210817_1818.py b/inkscape/migrations/0007_auto_20210817_1818.py new file mode 100644 index 00000000..d95c1ce1 --- /dev/null +++ b/inkscape/migrations/0007_auto_20210817_1818.py @@ -0,0 +1,20 @@ +# Generated by Django 2.0 on 2021-08-17 18:18 + +from django.db import migrations, models +import inkscape.models +import inkscape.utils + + +class Migration(migrations.Migration): + + dependencies = [ + ('inkscape', '0006_localstatic'), + ] + + operations = [ + migrations.AlterField( + model_name='localstatic', + name='static_file', + field=models.FileField(storage=inkscape.utils.StaticStore(), upload_to=inkscape.models.static_to), + ), + ] diff --git a/person/migrations/0033_auto_20210817_1818.py b/person/migrations/0033_auto_20210817_1818.py new file mode 100644 index 00000000..60379961 --- /dev/null +++ b/person/migrations/0033_auto_20210817_1818.py @@ -0,0 +1,34 @@ +# Generated by Django 2.0 on 2021-08-17 18:18 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('person', '0032_socialmediasite_is_funding'), + ] + + operations = [ + migrations.AlterField( + model_name='teamchatroom', + name='language', + field=models.CharField(choices=[('af', 'Afrikaans'), ('ar', 'Arabic'), ('ast', 'Asturian'), ('az', 'Azerbaijani'), ('bg', 'Bulgarian'), ('be', 'Belarusian'), ('bn', 'Bengali'), ('br', 'Breton'), ('bs', 'Bosnian'), ('ca', 'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'), ('de', 'German'), ('dsb', 'Lower Sorbian'), ('el', 'Greek'), ('en', 'English'), ('en-au', 'Australian English'), ('en-gb', 'British English'), ('eo', 'Esperanto'), ('es', 'Spanish'), ('es-ar', 'Argentinian Spanish'), ('es-co', 'Colombian Spanish'), ('es-mx', 'Mexican Spanish'), ('es-ni', 'Nicaraguan Spanish'), ('es-ve', 'Venezuelan Spanish'), ('et', 'Estonian'), ('eu', 'Basque'), ('fa', 'Persian'), ('fi', 'Finnish'), ('fr', 'French'), ('fy', 'Frisian'), ('ga', 'Irish'), ('gd', 'Scottish Gaelic'), ('gl', 'Galician'), ('he', 'Hebrew'), ('hi', 'Hindi'), ('hr', 'Croatian'), ('hsb', 'Upper Sorbian'), ('hu', 'Hungarian'), ('ia', 'Interlingua'), ('id', 'Indonesian'), ('io', 'Ido'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'), ('ka', 'Georgian'), ('kab', 'Kabyle'), ('kk', 'Kazakh'), ('km', 'Khmer'), ('kn', 'Kannada'), ('ko', 'Korean'), ('lb', 'Luxembourgish'), ('lt', 'Lithuanian'), ('lv', 'Latvian'), ('mk', 'Macedonian'), ('ml', 'Malayalam'), ('mn', 'Mongolian'), ('mr', 'Marathi'), ('my', 'Burmese'), ('nb', 'Norwegian Bokmål'), ('ne', 'Nepali'), ('nl', 'Dutch'), ('nn', 'Norwegian Nynorsk'), ('os', 'Ossetic'), ('pa', 'Punjabi'), ('pl', 'Polish'), ('pt', 'Portuguese'), ('pt-br', 'Brazilian Portuguese'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'), ('sq', 'Albanian'), ('sr', 'Serbian'), ('sr-latn', 'Serbian Latin'), ('sv', 'Swedish'), ('sw', 'Swahili'), ('ta', 'Tamil'), ('te', 'Telugu'), ('th', 'Thai'), ('tr', 'Turkish'), ('tt', 'Tatar'), ('udm', 'Udmurt'), ('uk', 'Ukrainian'), ('ur', 'Urdu'), ('vi', 'Vietnamese'), ('zh-hans', 'Simplified Chinese'), ('zh-hant', 'Traditional Chinese')], default='en', max_length=5), + ), + migrations.AlterField( + model_name='user', + name='language', + field=models.CharField(blank=True, choices=[('af', 'Afrikaans'), ('ar', 'Arabic'), ('ast', 'Asturian'), ('az', 'Azerbaijani'), ('bg', 'Bulgarian'), ('be', 'Belarusian'), ('bn', 'Bengali'), ('br', 'Breton'), ('bs', 'Bosnian'), ('ca', 'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'), ('de', 'German'), ('dsb', 'Lower Sorbian'), ('el', 'Greek'), ('en', 'English'), ('en-au', 'Australian English'), ('en-gb', 'British English'), ('eo', 'Esperanto'), ('es', 'Spanish'), ('es-ar', 'Argentinian Spanish'), ('es-co', 'Colombian Spanish'), ('es-mx', 'Mexican Spanish'), ('es-ni', 'Nicaraguan Spanish'), ('es-ve', 'Venezuelan Spanish'), ('et', 'Estonian'), ('eu', 'Basque'), ('fa', 'Persian'), ('fi', 'Finnish'), ('fr', 'French'), ('fy', 'Frisian'), ('ga', 'Irish'), ('gd', 'Scottish Gaelic'), ('gl', 'Galician'), ('he', 'Hebrew'), ('hi', 'Hindi'), ('hr', 'Croatian'), ('hsb', 'Upper Sorbian'), ('hu', 'Hungarian'), ('ia', 'Interlingua'), ('id', 'Indonesian'), ('io', 'Ido'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'), ('ka', 'Georgian'), ('kab', 'Kabyle'), ('kk', 'Kazakh'), ('km', 'Khmer'), ('kn', 'Kannada'), ('ko', 'Korean'), ('lb', 'Luxembourgish'), ('lt', 'Lithuanian'), ('lv', 'Latvian'), ('mk', 'Macedonian'), ('ml', 'Malayalam'), ('mn', 'Mongolian'), ('mr', 'Marathi'), ('my', 'Burmese'), ('nb', 'Norwegian Bokmål'), ('ne', 'Nepali'), ('nl', 'Dutch'), ('nn', 'Norwegian Nynorsk'), ('os', 'Ossetic'), ('pa', 'Punjabi'), ('pl', 'Polish'), ('pt', 'Portuguese'), ('pt-br', 'Brazilian Portuguese'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'), ('sq', 'Albanian'), ('sr', 'Serbian'), ('sr-latn', 'Serbian Latin'), ('sv', 'Swedish'), ('sw', 'Swahili'), ('ta', 'Tamil'), ('te', 'Telugu'), ('th', 'Thai'), ('tr', 'Turkish'), ('tt', 'Tatar'), ('udm', 'Udmurt'), ('uk', 'Ukrainian'), ('ur', 'Urdu'), ('vi', 'Vietnamese'), ('zh-hans', 'Simplified Chinese'), ('zh-hant', 'Traditional Chinese')], max_length=8, null=True, verbose_name='Default Language'), + ), + migrations.AlterField( + model_name='user', + name='last_name', + field=models.CharField(blank=True, max_length=150, verbose_name='last name'), + ), + migrations.AlterField( + model_name='usersocialmedia', + name='site', + field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='users', to='person.SocialMediaSite'), + ), + ] diff --git a/releases/migrations/0031_auto_20210817_1818.py b/releases/migrations/0031_auto_20210817_1818.py new file mode 100644 index 00000000..64f6a5e9 --- /dev/null +++ b/releases/migrations/0031_auto_20210817_1818.py @@ -0,0 +1,28 @@ +# Generated by Django 2.0 on 2021-08-17 18:18 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('releases', '0030_auto_20210717_1913'), + ] + + operations = [ + migrations.AlterField( + model_name='platformtranslation', + name='language', + field=models.CharField(choices=[('af', 'Afrikaans'), ('ar', 'Arabic'), ('ast', 'Asturian'), ('az', 'Azerbaijani'), ('bg', 'Bulgarian'), ('be', 'Belarusian'), ('bn', 'Bengali'), ('br', 'Breton'), ('bs', 'Bosnian'), ('ca', 'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'), ('de', 'German'), ('dsb', 'Lower Sorbian'), ('el', 'Greek'), ('eo', 'Esperanto'), ('es', 'Spanish'), ('es-ar', 'Argentinian Spanish'), ('es-co', 'Colombian Spanish'), ('es-mx', 'Mexican Spanish'), ('es-ni', 'Nicaraguan Spanish'), ('es-ve', 'Venezuelan Spanish'), ('et', 'Estonian'), ('eu', 'Basque'), ('fa', 'Persian'), ('fi', 'Finnish'), ('fr', 'French'), ('fy', 'Frisian'), ('ga', 'Irish'), ('gd', 'Scottish Gaelic'), ('gl', 'Galician'), ('he', 'Hebrew'), ('hi', 'Hindi'), ('hr', 'Croatian'), ('hsb', 'Upper Sorbian'), ('hu', 'Hungarian'), ('ia', 'Interlingua'), ('id', 'Indonesian'), ('io', 'Ido'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'), ('ka', 'Georgian'), ('kab', 'Kabyle'), ('kk', 'Kazakh'), ('km', 'Khmer'), ('kn', 'Kannada'), ('ko', 'Korean'), ('lb', 'Luxembourgish'), ('lt', 'Lithuanian'), ('lv', 'Latvian'), ('mk', 'Macedonian'), ('ml', 'Malayalam'), ('mn', 'Mongolian'), ('mr', 'Marathi'), ('my', 'Burmese'), ('nb', 'Norwegian Bokmål'), ('ne', 'Nepali'), ('nl', 'Dutch'), ('nn', 'Norwegian Nynorsk'), ('os', 'Ossetic'), ('pa', 'Punjabi'), ('pl', 'Polish'), ('pt', 'Portuguese'), ('pt-br', 'Brazilian Portuguese'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'), ('sq', 'Albanian'), ('sr', 'Serbian'), ('sr-latn', 'Serbian Latin'), ('sv', 'Swedish'), ('sw', 'Swahili'), ('ta', 'Tamil'), ('te', 'Telugu'), ('th', 'Thai'), ('tr', 'Turkish'), ('tt', 'Tatar'), ('udm', 'Udmurt'), ('uk', 'Ukrainian'), ('ur', 'Urdu'), ('vi', 'Vietnamese'), ('zh-hans', 'Simplified Chinese'), ('zh-hant', 'Traditional Chinese')], db_index=True, help_text='Which language is this translated into.', max_length=8, verbose_name='Language'), + ), + migrations.AlterField( + model_name='releaseplatformtranslation', + name='language', + field=models.CharField(choices=[('af', 'Afrikaans'), ('ar', 'Arabic'), ('ast', 'Asturian'), ('az', 'Azerbaijani'), ('bg', 'Bulgarian'), ('be', 'Belarusian'), ('bn', 'Bengali'), ('br', 'Breton'), ('bs', 'Bosnian'), ('ca', 'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'), ('de', 'German'), ('dsb', 'Lower Sorbian'), ('el', 'Greek'), ('eo', 'Esperanto'), ('es', 'Spanish'), ('es-ar', 'Argentinian Spanish'), ('es-co', 'Colombian Spanish'), ('es-mx', 'Mexican Spanish'), ('es-ni', 'Nicaraguan Spanish'), ('es-ve', 'Venezuelan Spanish'), ('et', 'Estonian'), ('eu', 'Basque'), ('fa', 'Persian'), ('fi', 'Finnish'), ('fr', 'French'), ('fy', 'Frisian'), ('ga', 'Irish'), ('gd', 'Scottish Gaelic'), ('gl', 'Galician'), ('he', 'Hebrew'), ('hi', 'Hindi'), ('hr', 'Croatian'), ('hsb', 'Upper Sorbian'), ('hu', 'Hungarian'), ('ia', 'Interlingua'), ('id', 'Indonesian'), ('io', 'Ido'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'), ('ka', 'Georgian'), ('kab', 'Kabyle'), ('kk', 'Kazakh'), ('km', 'Khmer'), ('kn', 'Kannada'), ('ko', 'Korean'), ('lb', 'Luxembourgish'), ('lt', 'Lithuanian'), ('lv', 'Latvian'), ('mk', 'Macedonian'), ('ml', 'Malayalam'), ('mn', 'Mongolian'), ('mr', 'Marathi'), ('my', 'Burmese'), ('nb', 'Norwegian Bokmål'), ('ne', 'Nepali'), ('nl', 'Dutch'), ('nn', 'Norwegian Nynorsk'), ('os', 'Ossetic'), ('pa', 'Punjabi'), ('pl', 'Polish'), ('pt', 'Portuguese'), ('pt-br', 'Brazilian Portuguese'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'), ('sq', 'Albanian'), ('sr', 'Serbian'), ('sr-latn', 'Serbian Latin'), ('sv', 'Swedish'), ('sw', 'Swahili'), ('ta', 'Tamil'), ('te', 'Telugu'), ('th', 'Thai'), ('tr', 'Turkish'), ('tt', 'Tatar'), ('udm', 'Udmurt'), ('uk', 'Ukrainian'), ('ur', 'Urdu'), ('vi', 'Vietnamese'), ('zh-hans', 'Simplified Chinese'), ('zh-hant', 'Traditional Chinese')], db_index=True, help_text='Which language is this translated into.', max_length=8, verbose_name='Language'), + ), + migrations.AlterField( + model_name='releasetranslation', + name='language', + field=models.CharField(choices=[('af', 'Afrikaans'), ('ar', 'Arabic'), ('ast', 'Asturian'), ('az', 'Azerbaijani'), ('bg', 'Bulgarian'), ('be', 'Belarusian'), ('bn', 'Bengali'), ('br', 'Breton'), ('bs', 'Bosnian'), ('ca', 'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'), ('de', 'German'), ('dsb', 'Lower Sorbian'), ('el', 'Greek'), ('eo', 'Esperanto'), ('es', 'Spanish'), ('es-ar', 'Argentinian Spanish'), ('es-co', 'Colombian Spanish'), ('es-mx', 'Mexican Spanish'), ('es-ni', 'Nicaraguan Spanish'), ('es-ve', 'Venezuelan Spanish'), ('et', 'Estonian'), ('eu', 'Basque'), ('fa', 'Persian'), ('fi', 'Finnish'), ('fr', 'French'), ('fy', 'Frisian'), ('ga', 'Irish'), ('gd', 'Scottish Gaelic'), ('gl', 'Galician'), ('he', 'Hebrew'), ('hi', 'Hindi'), ('hr', 'Croatian'), ('hsb', 'Upper Sorbian'), ('hu', 'Hungarian'), ('ia', 'Interlingua'), ('id', 'Indonesian'), ('io', 'Ido'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'), ('ka', 'Georgian'), ('kab', 'Kabyle'), ('kk', 'Kazakh'), ('km', 'Khmer'), ('kn', 'Kannada'), ('ko', 'Korean'), ('lb', 'Luxembourgish'), ('lt', 'Lithuanian'), ('lv', 'Latvian'), ('mk', 'Macedonian'), ('ml', 'Malayalam'), ('mn', 'Mongolian'), ('mr', 'Marathi'), ('my', 'Burmese'), ('nb', 'Norwegian Bokmål'), ('ne', 'Nepali'), ('nl', 'Dutch'), ('nn', 'Norwegian Nynorsk'), ('os', 'Ossetic'), ('pa', 'Punjabi'), ('pl', 'Polish'), ('pt', 'Portuguese'), ('pt-br', 'Brazilian Portuguese'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'), ('sq', 'Albanian'), ('sr', 'Serbian'), ('sr-latn', 'Serbian Latin'), ('sv', 'Swedish'), ('sw', 'Swahili'), ('ta', 'Tamil'), ('te', 'Telugu'), ('th', 'Thai'), ('tr', 'Turkish'), ('tt', 'Tatar'), ('udm', 'Udmurt'), ('uk', 'Ukrainian'), ('ur', 'Urdu'), ('vi', 'Vietnamese'), ('zh-hans', 'Simplified Chinese'), ('zh-hant', 'Traditional Chinese')], db_index=True, help_text='Which language is this translated into.', max_length=8, verbose_name='Language'), + ), + ] diff --git a/resources/migrations/0051_auto_20210817_1818.py b/resources/migrations/0051_auto_20210817_1818.py new file mode 100644 index 00000000..e5228c48 --- /dev/null +++ b/resources/migrations/0051_auto_20210817_1818.py @@ -0,0 +1,21 @@ +# Generated by Django 2.0 on 2021-08-17 18:18 + +import cms.utils.permissions +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('resources', '0050_auto_20210617_0027'), + ] + + operations = [ + migrations.AlterField( + model_name='resourcemirror', + name='manager', + field=models.ForeignKey(default=cms.utils.permissions.get_current_user, on_delete=django.db.models.deletion.SET_DEFAULT, to=settings.AUTH_USER_MODEL), + ), + ] diff --git a/stats/migrations/0004_auto_20210817_1818.py b/stats/migrations/0004_auto_20210817_1818.py new file mode 100644 index 00000000..9ec5bf05 --- /dev/null +++ b/stats/migrations/0004_auto_20210817_1818.py @@ -0,0 +1,18 @@ +# Generated by Django 2.0 on 2021-08-17 18:18 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('stats', '0003_auto_20200916_0806'), + ] + + operations = [ + migrations.AlterField( + model_name='languageaccess', + name='language', + field=models.CharField(choices=[('af', 'Afrikaans'), ('ar', 'Arabic'), ('ast', 'Asturian'), ('az', 'Azerbaijani'), ('bg', 'Bulgarian'), ('be', 'Belarusian'), ('bn', 'Bengali'), ('br', 'Breton'), ('bs', 'Bosnian'), ('ca', 'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'), ('de', 'German'), ('dsb', 'Lower Sorbian'), ('el', 'Greek'), ('eo', 'Esperanto'), ('es', 'Spanish'), ('es-ar', 'Argentinian Spanish'), ('es-co', 'Colombian Spanish'), ('es-mx', 'Mexican Spanish'), ('es-ni', 'Nicaraguan Spanish'), ('es-ve', 'Venezuelan Spanish'), ('et', 'Estonian'), ('eu', 'Basque'), ('fa', 'Persian'), ('fi', 'Finnish'), ('fr', 'French'), ('fy', 'Frisian'), ('ga', 'Irish'), ('gd', 'Scottish Gaelic'), ('gl', 'Galician'), ('he', 'Hebrew'), ('hi', 'Hindi'), ('hr', 'Croatian'), ('hsb', 'Upper Sorbian'), ('hu', 'Hungarian'), ('ia', 'Interlingua'), ('id', 'Indonesian'), ('io', 'Ido'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'), ('ka', 'Georgian'), ('kab', 'Kabyle'), ('kk', 'Kazakh'), ('km', 'Khmer'), ('kn', 'Kannada'), ('ko', 'Korean'), ('lb', 'Luxembourgish'), ('lt', 'Lithuanian'), ('lv', 'Latvian'), ('mk', 'Macedonian'), ('ml', 'Malayalam'), ('mn', 'Mongolian'), ('mr', 'Marathi'), ('my', 'Burmese'), ('nb', 'Norwegian Bokmål'), ('ne', 'Nepali'), ('nl', 'Dutch'), ('nn', 'Norwegian Nynorsk'), ('os', 'Ossetic'), ('pa', 'Punjabi'), ('pl', 'Polish'), ('pt', 'Portuguese'), ('pt-br', 'Brazilian Portuguese'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'), ('sq', 'Albanian'), ('sr', 'Serbian'), ('sr-latn', 'Serbian Latin'), ('sv', 'Swedish'), ('sw', 'Swahili'), ('ta', 'Tamil'), ('te', 'Telugu'), ('th', 'Thai'), ('tr', 'Turkish'), ('tt', 'Tatar'), ('udm', 'Udmurt'), ('uk', 'Ukrainian'), ('ur', 'Urdu'), ('vi', 'Vietnamese'), ('zh-hans', 'Simplified Chinese'), ('zh-hant', 'Traditional Chinese')], db_index=True, max_length=8), + ), + ] -- GitLab From 37049beb1cf90332187e187c0132fb5cb5232e91 Mon Sep 17 00:00:00 2001 From: pulsar17 <5243241-pulsar17@users.noreply.gitlab.com> Date: Wed, 18 Aug 2021 00:16:17 +0530 Subject: [PATCH 08/19] Upgrade dependency versions for Django 2.0 - initial pass --- requirements.txt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/requirements.txt b/requirements.txt index 780882e1..9e887ecc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,12 +4,13 @@ unidecode python-dateutil==2.7.3 whoosh==2.7.4 pygments==2.2.0 -django==1.11.15 +django==2.0 django-ajax-selects==1.7.0 django-haystack==2.8.1 django-contrib-comments==1.8.0 django-markdown-deux==1.0.5 -django-boxed-alerts==1.3.5 +# django-boxed-alerts==1.3.5 +git+https://gitlab.com/doctormo/django-boxed-alerts#egg=django-boxed-alerts django-ical==1.7.0 django-recurrence==1.10.3 @@ -17,8 +18,10 @@ django-recurrence==1.10.3 django-cms==3.7.3 djangocms-file==2.4.0 cmsplugin-search==0.8.0 -cmsplugin-alerts==1.2.2 -cmsplugin-diff==1.2.3 +# cmsplugin-alerts==1.2.2 +git+https://gitlab.com/pulsar17/django-cmsplugin-alerts#egg=cmsplugin-alerts +# cmsplugin-diff==1.2.3 +git+https://gitlab.com/pulsar17/django-cmsplugin-diff#egg=cmsplugin-diff djangocms-text-ckeditor==3.9.1 # download_remote_images command -- GitLab From d971afc5596309f6d487baae46cbe5e389e72ad8 Mon Sep 17 00:00:00 2001 From: pulsar17 <5243241-pulsar17@users.noreply.gitlab.com> Date: Wed, 18 Aug 2021 19:40:14 +0530 Subject: [PATCH 09/19] Change is_authenticated from method to attribute for Django 2.0 --- cmstabs/cms_toolbar_objects.py | 2 +- cog/middleware.py | 2 +- elections/mixins.py | 2 +- forums/alert.py | 2 +- forums/querysets.py | 4 ++-- forums/views.py | 2 +- inkscape/views.py | 4 ++-- moderation/templatetags/moderator.py | 2 +- person/models.py | 4 ++-- person/templatetags/memberships.py | 2 +- resources/alert.py | 2 +- resources/forms.py | 2 +- resources/mixins.py | 4 ++-- resources/templatetags/galleries.py | 2 +- resources/video_url.py | 4 ++-- resources/views.py | 8 ++++---- 16 files changed, 24 insertions(+), 24 deletions(-) diff --git a/cmstabs/cms_toolbar_objects.py b/cmstabs/cms_toolbar_objects.py index 135ed932..1e93715c 100644 --- a/cmstabs/cms_toolbar_objects.py +++ b/cmstabs/cms_toolbar_objects.py @@ -41,7 +41,7 @@ CMSToolbar.render_with_structure = new_rws class ObjectsToolbar(SubToolbar): """Adds an Objects menu item for quick admin access to current context""" def populate(self): - if self.request.user.is_authenticated() and self.request.user.is_staff: + if self.request.user.is_authenticated and self.request.user.is_staff: if hasattr(self.toolbar, 'response_context'): self.add_menu(self.toolbar.response_context) diff --git a/cog/middleware.py b/cog/middleware.py index aafa701b..98ce805e 100644 --- a/cog/middleware.py +++ b/cog/middleware.py @@ -49,7 +49,7 @@ class UserOnErrorMiddleware(object): def direct_link(self, request): """But try and put a direct link in anyway (if possible)""" try: - if request.user.is_authenticated(): + if request.user.is_authenticated: url = request.user.get_absolute_url() request.META['USER_URL'] = self.server + url except KeyError: diff --git a/elections/mixins.py b/elections/mixins.py index 3c80a7be..5ba970d7 100644 --- a/elections/mixins.py +++ b/elections/mixins.py @@ -38,5 +38,5 @@ class TeamMemberMixin(RestrictedMixin): def is_allowed(self, user): """Test this user is a constituent of this election (voter)""" team = self.get_object().constituents - return user.is_authenticated() and team.has_member(user) + return user.is_authenticated and team.has_member(user) diff --git a/forums/alert.py b/forums/alert.py index dd5c7e95..9e1fb185 100644 --- a/forums/alert.py +++ b/forums/alert.py @@ -99,7 +99,7 @@ class ForumTopicAlert(BaseAlert): @classmethod def subscriptions_for(cls, user): """Return a list of subscriptions for this user""" - if user is not None and user.is_authenticated(): + if user is not None and user.is_authenticated: return user.alert_subscriptions.filter(alert__slug=cls.slug) return AlertSubscription.objects.none() diff --git a/forums/querysets.py b/forums/querysets.py index 93abe8c4..ae934db9 100644 --- a/forums/querysets.py +++ b/forums/querysets.py @@ -42,7 +42,7 @@ class ForumQuerySet(QuerySet): def for_user(self, user): """Filter out un-needed forums""" - if user and user.is_authenticated(): + if user and user.is_authenticated: teams = user.teams.all() return self.filter(Q(team__isnull=True) | Q(team__in=teams)) return self.filter(team__isnull=True) @@ -64,7 +64,7 @@ class TopicQuerySet(QuerySet): def for_user(self, user): """Set the user and filter out un-needed topics""" - if user and user.is_authenticated(): + if user and user.is_authenticated: teams = user.teams.all() return self.filter(Q(forum__team__isnull=True) | Q(forum__team__in=teams)) return self.filter(forum__team__isnull=True) diff --git a/forums/views.py b/forums/views.py index 56985e3c..830f1d06 100644 --- a/forums/views.py +++ b/forums/views.py @@ -100,7 +100,7 @@ class TopicList(UserVisit, ForumMixin, ListView): user = get_object_or_404(get_user_model(), username=self.kwargs['username']) qset = qset.filter(first_username=self.kwargs['username']) self.set_context_datum('forum_user', user) - if self.request.user.is_authenticated(): + if self.request.user.is_authenticated: qset.set_user(self.request.user) if self.kwargs: self.set_context_datum('rss', reverse("forums:topic_feed", kwargs=self.kwargs)) diff --git a/inkscape/views.py b/inkscape/views.py index e3dcb2a0..5e2433fb 100644 --- a/inkscape/views.py +++ b/inkscape/views.py @@ -84,7 +84,7 @@ class ContactUs(FormView): def get_initial(self): ret = {'subject': self.request.GET.get('subject', "Website Feedback")} - if self.request.user.is_authenticated(): + if self.request.user.is_authenticated: ret['email'] = self.request.user.email return ret @@ -97,7 +97,7 @@ class ContactUs(FormView): return super(ContactUs, self).form_valid(form) def get_sender(self, email): - if self.request.user.is_authenticated(): + if self.request.user.is_authenticated: user = self.request.user if not user.first_name: return email diff --git a/moderation/templatetags/moderator.py b/moderation/templatetags/moderator.py index b3ea4502..0894c50b 100644 --- a/moderation/templatetags/moderator.py +++ b/moderation/templatetags/moderator.py @@ -47,7 +47,7 @@ def flag_url(context, obj=None): @register.filter def is_flagged(obj, user): - if user and user.is_authenticated(): + if user and user.is_authenticated: ct = ContentType.objects.get_for_model(obj) return FlagVote.objects.filter( moderator_id=user.pk, diff --git a/person/models.py b/person/models.py index 956ff143..5cd54dc3 100644 --- a/person/models.py +++ b/person/models.py @@ -234,7 +234,7 @@ class User(AbstractUser): def viewer_is_subscribed(self, user): """Returns true if the calling user is subscribed to this user's resources.""" - if user.is_authenticated(): + if user.is_authenticated: try: return bool(self.resources.subscriptions().get(user=user.pk)) except AlertSubscription.DoesNotExist: @@ -314,7 +314,7 @@ class TwilightSparkle(Manager): def i_added(self, user): """Return true if I have added this friend before""" try: - return user.is_authenticated() and bool(self.get(from_user=user.pk)) + return user.is_authenticated and bool(self.get(from_user=user.pk)) except Friendship.DoesNotExist: return False diff --git a/person/templatetags/memberships.py b/person/templatetags/memberships.py index e5d7305e..ed07db16 100644 --- a/person/templatetags/memberships.py +++ b/person/templatetags/memberships.py @@ -30,7 +30,7 @@ register = Library() # pylint: disable=invalid-name @register.filter() def is_subscribed(this_user, that_user): """Returns true if that_user is subscribed to this_user""" - if this_user.is_authenticated(): + if this_user.is_authenticated: return this_user.viewer_is_subscribed(that_user) return False diff --git a/resources/alert.py b/resources/alert.py index abe9ce9b..a6aee665 100644 --- a/resources/alert.py +++ b/resources/alert.py @@ -106,6 +106,6 @@ class GalleryAlert(AddedAlert): @classmethod def subscriptions_for(cls, user): """Return a list of subscriptions for this user""" - if user is not None and user.is_authenticated(): + if user is not None and user.is_authenticated: return user.alert_subscriptions.filter(alert__slug=cls.slug) return AlertSubscription.objects.none() diff --git a/resources/forms.py b/resources/forms.py index cd2c2ef1..5669b630 100644 --- a/resources/forms.py +++ b/resources/forms.py @@ -157,7 +157,7 @@ class ResourceBaseForm(ModelForm): for key in self.Meta.required: self.fields[key].required = True - if not self.user.is_authenticated(): + if not self.user.is_authenticated: raise ValueError("Anonymous user can't create or edit resources!") if not self.user.has_perm('resources.change_resourcemirror'): diff --git a/resources/mixins.py b/resources/mixins.py index 43f8fc0b..d144ce21 100644 --- a/resources/mixins.py +++ b/resources/mixins.py @@ -84,7 +84,7 @@ class OwnerUpdateMixin(object): def dispatch(self, request, *args, **kwargs): """ Making sure that only authors can update stories """ if not self.is_allowed(): - if not request.user.is_authenticated() and request.method == 'GET': + if not request.user.is_authenticated and request.method == 'GET': return redirect_to_login(request.build_absolute_uri()) raise PermissionDenied() @@ -125,7 +125,7 @@ class OwnerUpdateMixin(object): class OwnerCreateMixin(OwnerUpdateMixin): """Who is allowed to create things""" def is_allowed(self): - return self.request.user.is_authenticated() + return self.request.user.is_authenticated def get_context_data(self, **kwargs): data = super(OwnerCreateMixin, self).get_context_data(**kwargs) diff --git a/resources/templatetags/galleries.py b/resources/templatetags/galleries.py index c62b6b58..8abed1a7 100644 --- a/resources/templatetags/galleries.py +++ b/resources/templatetags/galleries.py @@ -29,7 +29,7 @@ register = Library() # pylint: disable=invalid-name def is_gallery_subscribed(user, gallery): """Is the user subscribed to this gallery""" from ..alert import GalleryAlert - if user.is_authenticated(): + if user.is_authenticated: subs = GalleryAlert.subscriptions_for(user) return subs.filter(target=gallery.pk) return False diff --git a/resources/video_url.py b/resources/video_url.py index 5097fae9..ae62e151 100644 --- a/resources/video_url.py +++ b/resources/video_url.py @@ -112,7 +112,7 @@ def parse_any_url(query, user, allow_any=False): and match_v['type'] == is_video['type']: return match - if user.is_authenticated(): + if user.is_authenticated: # Create a new video object in our resource database. details = video_detect(query, True) obj = Resource( @@ -149,7 +149,7 @@ def parse_any_url(query, user, allow_any=False): desc = details['description'] rendering = url_filefield(details['image']) - if user.is_authenticated(): + if user.is_authenticated: # Create a new link object in our resource database. ret = Resource(user=user, name=name, owner_name='Internet', desc=desc, rendering=rendering, link=query, owner=False, published=False) diff --git a/resources/views.py b/resources/views.py index c824826d..6a489f8c 100644 --- a/resources/views.py +++ b/resources/views.py @@ -134,7 +134,7 @@ class CheckResource(SingleObjectMixin, RedirectView): obj = self.get_object() gallery = obj.gallery - if not request.user.is_authenticated() and gallery.user != request.user and \ + if not request.user.is_authenticated and gallery.user != request.user and \ (gallery.group not in request.user.groups.all()): raise PermissionDenied() @@ -265,7 +265,7 @@ class QuotaJson(View): """Returns a Json snippet with information about a user's quota""" def get(self, request): context = {'user': 'unknown', 'quota': 0, 'used': 0} - if request.user.is_authenticated(): + if request.user.is_authenticated: context.update({ 'user': request.user.username, 'used': request.user.resources.disk_usage(), @@ -527,7 +527,7 @@ class UnpublishedGallery(ListView): def get_queryset(self): qset = super().get_queryset() - if self.request.user.is_authenticated(): + if self.request.user.is_authenticated: qset = qset.filter(published=False, is_removed=False, user=self.request.user) else: qset = qset.none() @@ -602,7 +602,7 @@ class ResourceList(CategoryListView): def in_team(self): """Returns True if the user is in a team""" if not hasattr(self.request, 'my_in_team'): - if self.request.user.is_authenticated(): + if self.request.user.is_authenticated: teams = self.request.user.teams else: teams = Team.objects.none() -- GitLab From 70420a0d7c1eafeb2384c08dba0fe82c82c58d9a Mon Sep 17 00:00:00 2001 From: pulsar17 <5243241-pulsar17@users.noreply.gitlab.com> Date: Thu, 19 Aug 2021 16:41:54 +0530 Subject: [PATCH 10/19] Change all middlewares to use new-style --- cog/middleware.py | 9 +++++++-- inkscape/middleware.py | 16 ++++++++++++++++ inkscape/settings.py | 13 ++++++------- person/middleware.py | 15 ++++++++++----- 4 files changed, 39 insertions(+), 14 deletions(-) diff --git a/cog/middleware.py b/cog/middleware.py index 98ce805e..b0de3ee0 100644 --- a/cog/middleware.py +++ b/cog/middleware.py @@ -24,12 +24,17 @@ from django.conf import settings # We could add this to middleware.py, but it's getting a bit full # and this file is empty enough that it won't bother anyone. -class UserOnErrorMiddleware(object): +class UserOnErrorMiddleware: """Add a link to the user in errors (if possible)""" cookie_key = getattr(settings, 'SESSION_COOKIE_NAME', None) - def __init__(self): + def __init__(self, get_response): + self.get_response = get_response self.server = None + + def __call__(self, request): + response = self.get_response(request) + return response def process_exception(self, request, exception): """When each request is made, this is run to add users""" diff --git a/inkscape/middleware.py b/inkscape/middleware.py index c45649f5..460ddfea 100644 --- a/inkscape/middleware.py +++ b/inkscape/middleware.py @@ -58,10 +58,19 @@ class TrackCacheMiddleware(BaseMiddleware): does not understand what they are for or how they work during the FetchCache process. """ + cache_timeout = settings.CACHE_MIDDLEWARE_SECONDS key_prefix = settings.CACHE_MIDDLEWARE_KEY_PREFIX cache = caches[settings.CACHE_MIDDLEWARE_ALIAS] + def __init__(self, get_response): + self.get_response = get_response + + def __call__(self, request): + response = self.get_response(request) + response = self.process_response(request, response) + return response + @classmethod def fastly_cache(cls): if not hasattr(cls, '_fastly'): @@ -276,6 +285,13 @@ class AutoBreadcrumbMiddleware(BaseMiddleware): """ keys = ('breadcrumbs', 'title') + def __init__(self, get_response): + self.get_response = get_response + + def __call__(self, request): + response = self.get_response(request) + return response + def process_template_response(self, request, response): if not hasattr(response, 'context_data'): return response diff --git a/inkscape/settings.py b/inkscape/settings.py index b7ef35d4..50991384 100644 --- a/inkscape/settings.py +++ b/inkscape/settings.py @@ -130,7 +130,7 @@ TEMPLATES = [{ } }] -MIDDLEWARE_CLASSES = ( +MIDDLEWARE = [ 'cog.middleware.UserOnErrorMiddleware', 'inkscape.middleware.AutoBreadcrumbMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', @@ -138,7 +138,6 @@ MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'social_django.middleware.SocialAuthExceptionMiddleware', 'cms.middleware.page.CurrentPageMiddleware', @@ -148,7 +147,7 @@ MIDDLEWARE_CLASSES = ( 'person.middleware.SetLastVisitMiddleware', 'django.contrib.redirects.middleware.RedirectFallbackMiddleware', 'forums.middleware.RecentUsersMiddleware' -) +] # ===== CACHING ===== # @@ -160,10 +159,10 @@ if ENABLE_CACHING or IS_TEST: 'menus': 0, } - MIDDLEWARE_CLASSES = \ - ('django.middleware.cache.UpdateCacheMiddleware',) + \ - MIDDLEWARE_CLASSES + \ - ('django.middleware.cache.FetchFromCacheMiddleware',) + MIDDLEWARE = \ + ['django.middleware.cache.UpdateCacheMiddleware'] + \ + MIDDLEWARE + \ + ['django.middleware.cache.FetchFromCacheMiddleware'] # Template caching allows quicker fetches TEMPLATES[0]['OPTIONS']['loaders'] = [( diff --git a/person/middleware.py b/person/middleware.py index f1aa42d2..3175cdbe 100644 --- a/person/middleware.py +++ b/person/middleware.py @@ -23,13 +23,18 @@ Model for specific user middleware from django.utils.timezone import now -class SetLastVisitMiddleware(object): + +class SetLastVisitMiddleware: """ Provide a user tracking date/time stamp update middleware. """ - def process_request(self, request): - """Process request happens before page view""" - if request.user.is_authenticated(): + + def __init__(self, get_response): + self.get_response = get_response + + def __call__(self, request): + if request.user.is_authenticated: request.user.last_seen = now() request.user.save(update_fields=['last_seen']) - + response = self.get_response(request) + return response -- GitLab From f065018f66d262f5cc6a6460e08c4c0d26798fb7 Mon Sep 17 00:00:00 2001 From: pulsar17 <5243241-pulsar17@users.noreply.gitlab.com> Date: Thu, 19 Aug 2021 19:13:58 +0530 Subject: [PATCH 11/19] Fix forums fixture by removing sync field --- forums/fixtures/forums.json | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/forums/fixtures/forums.json b/forums/fixtures/forums.json index 8bdecbfb..d25b4465 100644 --- a/forums/fixtures/forums.json +++ b/forums/fixtures/forums.json @@ -46,7 +46,6 @@ "resources", "resource" ], - "sync": null, "post_count": 1214, "last_posted": "2018-11-13T15:37:35Z" } @@ -63,7 +62,6 @@ "icon": "forum/icon/art_general.svg", "lang": null, "content_type": null, - "sync": null, "post_count": 25, "last_posted": "2018-11-24T01:09:40.097Z" } @@ -80,7 +78,6 @@ "icon": "forum/icon/school.svg", "lang": null, "content_type": null, - "sync": null, "post_count": 4, "last_posted": "2016-06-22T02:30:05Z" } @@ -97,7 +94,6 @@ "icon": "forum/icon/ext.png", "lang": null, "content_type": null, - "sync": null, "post_count": 0, "last_posted": null } @@ -114,7 +110,6 @@ "icon": "forum/icon/bugs.svg", "lang": null, "content_type": null, - "sync": null, "post_count": 0, "last_posted": null } @@ -131,7 +126,6 @@ "icon": "forum/icon/basic_q.svg", "lang": null, "content_type": null, - "sync": null, "post_count": 4, "last_posted": "2018-11-23T15:45:34.843Z" } @@ -148,7 +142,6 @@ "icon": "forum/icon/basic_b.svg", "lang": null, "content_type": null, - "sync": null, "post_count": 0, "last_posted": null } @@ -165,7 +158,6 @@ "icon": "forum/icon/compet.svg", "lang": null, "content_type": null, - "sync": null, "post_count": 0, "last_posted": null } @@ -182,7 +174,6 @@ "icon": "forum/icon/graph.svg", "lang": null, "content_type": null, - "sync": null, "post_count": 0, "last_posted": null } @@ -199,7 +190,6 @@ "icon": "forum/icon/laser.svg", "lang": null, "content_type": null, - "sync": null, "post_count": 0, "last_posted": null } @@ -216,7 +206,6 @@ "icon": "forum/icon/www.svg", "lang": null, "content_type": null, - "sync": null, "post_count": 0, "last_posted": null } @@ -233,7 +222,6 @@ "icon": "forum/icon/ani.svg", "lang": null, "content_type": null, - "sync": null, "post_count": 0, "last_posted": null } @@ -250,7 +238,6 @@ "icon": "forum/icon/pony.svg", "lang": null, "content_type": null, - "sync": null, "post_count": 0, "last_posted": null } @@ -267,7 +254,6 @@ "icon": "forum/icon/art_gallery.svg", "lang": null, "content_type": null, - "sync": null, "post_count": 0, "last_posted": null } @@ -284,7 +270,6 @@ "icon": "forum/icon/educators.svg", "lang": null, "content_type": null, - "sync": null, "post_count": 0, "last_posted": null } -- GitLab From f12ced220529abb9055102a7429cc70919a8068a Mon Sep 17 00:00:00 2001 From: pulsar17 <5243241-pulsar17@users.noreply.gitlab.com> Date: Sat, 21 Aug 2021 00:30:31 +0530 Subject: [PATCH 12/19] Fix sqlite error due to a migration --- cmsplugin_image/migrations/0003_auto_20160907_2241.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cmsplugin_image/migrations/0003_auto_20160907_2241.py b/cmsplugin_image/migrations/0003_auto_20160907_2241.py index e6e27b11..6536cc0a 100644 --- a/cmsplugin_image/migrations/0003_auto_20160907_2241.py +++ b/cmsplugin_image/migrations/0003_auto_20160907_2241.py @@ -5,6 +5,7 @@ from django.db import migrations, models class Migration(migrations.Migration): + atomic = False dependencies = [ ('cmsplugin_image', '0002_auto_20160907_2044'), -- GitLab From c2feffc8b2623928fc616ee4665d4c269d8ae419 Mon Sep 17 00:00:00 2001 From: pulsar17 <5243241-pulsar17@users.noreply.gitlab.com> Date: Mon, 23 Aug 2021 00:50:23 +0530 Subject: [PATCH 13/19] Fix wrong mark_safe imports --- forums/admin.py | 2 +- stats/admin.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/forums/admin.py b/forums/admin.py index 1d016f45..42eb76a7 100644 --- a/forums/admin.py +++ b/forums/admin.py @@ -24,7 +24,7 @@ Admin interfaces for comments and forums. from django_comments.models import CommentFlag, Comment from django_comments.admin import CommentsAdmin -from django.utils.text import mark_safe +from django.utils.safestring import mark_safe from django.contrib.admin import ModelAdmin, register, TabularInline from django.contrib.contenttypes.admin import GenericTabularInline diff --git a/stats/admin.py b/stats/admin.py index 83978557..fe554181 100644 --- a/stats/admin.py +++ b/stats/admin.py @@ -21,7 +21,6 @@ Admin for website stats (mostly debugging) """ -#from django.utils.text import mark_safe from django.contrib.admin import ModelAdmin, register from .models import ( -- GitLab From ab06bf1cceaced3d67b8871546e9a87d23420325 Mon Sep 17 00:00:00 2001 From: pulsar17 <5243241-pulsar17@users.noreply.gitlab.com> Date: Thu, 26 Aug 2021 23:18:34 +0530 Subject: [PATCH 14/19] Add renderer arg to widget's render method --- forums/widgets.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/forums/widgets.py b/forums/widgets.py index 0b31230b..79f49349 100644 --- a/forums/widgets.py +++ b/forums/widgets.py @@ -49,8 +49,8 @@ class TextEditorWidget(Textarea): self.action_token = action_token self.delete_on_cancel = delete_on_cancel - def render_textarea(self, name, value, attrs=None): - return super(TextEditorWidget, self).render(name, value, attrs) + def render_textarea(self, name, value, attrs=None, renderer=None): + return super(TextEditorWidget, self).render(name, value, attrs, renderer) def render_additions(self, name, value, attrs=None): # id attribute is always present when rendering a widget @@ -65,7 +65,7 @@ class TextEditorWidget(Textarea): } return mark_safe(render_to_string('forums/ckeditor.html', context)) - def render(self, name, value, attrs=None): + def render(self, name, value, attrs=None, renderer=None): return ( - self.render_textarea(name, value, attrs) + self.render_additions(name, value, attrs) + self.render_textarea(name, value, attrs, renderer) + self.render_additions(name, value, attrs) ) -- GitLab From 6fe2585e0fd67327bb67dd0a239f77bd3295b4d4 Mon Sep 17 00:00:00 2001 From: pulsar17 <5243241-pulsar17@users.noreply.gitlab.com> Date: Thu, 26 Aug 2021 23:19:11 +0530 Subject: [PATCH 15/19] Fix broken tests on upgrade --- forums/tests/test_forms.py | 1 - releases/tests/test_admin.py | 2 +- releases/tests/test_models.py | 7 ++++--- releases/tests/test_views.py | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/forums/tests/test_forms.py b/forums/tests/test_forms.py index 8884a916..81d0ce18 100644 --- a/forums/tests/test_forms.py +++ b/forums/tests/test_forms.py @@ -156,7 +156,6 @@ class TestAttachmentMixin(GetTestUsersMixin, TestCase): flag=UserFlag.FLAG_BANNED, title='Banned' ) - self.user.forum_flags.add(flag=flag) with self.assertRaises(ValidationError) as err: mixin = self.get_mixin_instance() diff --git a/releases/tests/test_admin.py b/releases/tests/test_admin.py index 7812fc5e..e135c2f4 100644 --- a/releases/tests/test_admin.py +++ b/releases/tests/test_admin.py @@ -93,7 +93,7 @@ class TestReleaseForm(AdminFormTestMixin, TestCase): returned = form.parent_queryset(Release.objects.all()) expected = [ Release.objects.get(version=version) - for version in ['1.1', '1.0.x', '0.91', '0.48'] + for version in ['0.91', '0.48', '1.1', '1.0.x'] ] self.assertQuerysetEqual(returned, expected, transform=lambda x: x) diff --git a/releases/tests/test_models.py b/releases/tests/test_models.py index d1cb356b..304290e0 100644 --- a/releases/tests/test_models.py +++ b/releases/tests/test_models.py @@ -148,7 +148,8 @@ class TestRelease(base.ModelTestCase): self.instance = self.release = Release.objects.get(version='1.1') def test_model_meta_has_correct_ordering(self): - self.assertEqual(self.release._meta.ordering, ('-release_date', '-version')) + self.assertEqual(self.release._meta.ordering, + ('-release_date', '-version')) def test_model_meta_has_correct_get_latest_by(self): self.assertEqual(self.release._meta.get_latest_by, 'release_date') @@ -232,8 +233,8 @@ class TestRelease(base.ModelTestCase): # We expect all versions to be present since all the versions either # have no parent or they are the children of 1.0 (parent of 1.0.1) - versions = ['1.1', '1.0.x', '1.0.2', '1.0.1', '1.0', - '1.0alpha2', '1.0alpha0', '0.91', '0.48'] + versions = ['1.0.2', '1.0.1', '1.0', '1.0alpha2', '1.0alpha0', + '0.91', '0.48', '1.1', '1.0.x'] self.assertListEqual(list(returned_versions), versions) diff --git a/releases/tests/test_views.py b/releases/tests/test_views.py index d8dda887..e3ed5d93 100644 --- a/releases/tests/test_views.py +++ b/releases/tests/test_views.py @@ -265,16 +265,16 @@ class TestReleaseView(GetTestUsersMixin, base.ViewTestCase): TestData( input='1.1', expected={ - 'revisions': ['1.1', '1.1rc1'], - 'hidden_versions': ['1.1', '1.1rc1'], + 'revisions': ['1.1rc1', '1.1'], + 'hidden_versions': ['1.1rc1', '1.1'], }, case="A top level release that hasn't been released yet." ), TestData( input='1.1rc1', expected={ - 'revisions': ['1.1', '1.1rc1'], - 'hidden_versions': ['1.1', '1.1rc1'], + 'revisions': ['1.1rc1', '1.1'], + 'hidden_versions': ['1.1rc1', '1.1'], }, case="A pre-release whose parent release(1.1) hasn't been released." ), -- GitLab From 58b83a51bb5116110497545cfc89dcba84d9d2f5 Mon Sep 17 00:00:00 2001 From: pulsar17 <5243241-pulsar17@users.noreply.gitlab.com> Date: Thu, 26 Aug 2021 23:19:32 +0530 Subject: [PATCH 16/19] Make migrations work with sqlite --- resources/migrations/0011_auto_20160131_1814.py | 2 ++ resources/migrations/0039_auto_20170505_1443.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/resources/migrations/0011_auto_20160131_1814.py b/resources/migrations/0011_auto_20160131_1814.py index 9baf0754..98c82b6b 100644 --- a/resources/migrations/0011_auto_20160131_1814.py +++ b/resources/migrations/0011_auto_20160131_1814.py @@ -6,6 +6,8 @@ from django.db import models, migrations class Migration(migrations.Migration): + atomic = False + dependencies = [ ('resources', '0010_auto_20160130_0259'), ] diff --git a/resources/migrations/0039_auto_20170505_1443.py b/resources/migrations/0039_auto_20170505_1443.py index 1b0d83b7..1723fe46 100644 --- a/resources/migrations/0039_auto_20170505_1443.py +++ b/resources/migrations/0039_auto_20170505_1443.py @@ -6,6 +6,8 @@ from django.db import migrations, models class Migration(migrations.Migration): + atomic = False + dependencies = [ ('resources', '0038_resource_is_removed'), ] -- GitLab From 142071b1b97e774ddb025e468aa9f2e81f821584 Mon Sep 17 00:00:00 2001 From: pulsar17 <5243241-pulsar17@users.noreply.gitlab.com> Date: Thu, 26 Aug 2021 23:29:37 +0530 Subject: [PATCH 17/19] Remove unnecessary IS_TEST check --- inkscape/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inkscape/settings.py b/inkscape/settings.py index 50991384..d665d2ed 100644 --- a/inkscape/settings.py +++ b/inkscape/settings.py @@ -151,7 +151,7 @@ MIDDLEWARE = [ # ===== CACHING ===== # -if ENABLE_CACHING or IS_TEST: +if ENABLE_CACHING: # Caching Middleware caches whole pages, can cause issues CMS_CACHE_DURATIONS = { 'content': CACHE_PAGE_SETTING, -- GitLab From 8fc3db1a7b0edf5a286c83a9f95d12cb1820442c Mon Sep 17 00:00:00 2001 From: pulsar17 <5243241-pulsar17@users.noreply.gitlab.com> Date: Thu, 26 Aug 2021 23:30:02 +0530 Subject: [PATCH 18/19] Fix possibly unclosed file --- inkscape/context_processors.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/inkscape/context_processors.py b/inkscape/context_processors.py index 06fafeeb..4a9f6a5f 100644 --- a/inkscape/context_processors.py +++ b/inkscape/context_processors.py @@ -58,8 +58,9 @@ def proc_date(d): VERSION_FILE = os.path.join(PATH, 'version') if os.path.isfile(VERSION_FILE): - MSG = email.message_from_file(open(VERSION_FILE)) - WEBSITE_VERSION = str(MSG["version"]) + with open(VERSION_FILE, 'r') as fhl: + MSG = email.message_from_file(fhl) + WEBSITE_VERSION = str(MSG["version"]) REVISION_FILE = os.path.join(PATH, 'data', 'revision') if os.path.isfile(REVISION_FILE): -- GitLab From 11c58b636795777399ac063944367700cab22393 Mon Sep 17 00:00:00 2001 From: pulsar17 <5243241-pulsar17@users.noreply.gitlab.com> Date: Thu, 26 Aug 2021 23:31:55 +0530 Subject: [PATCH 19/19] Upgrade Django to 2.1.15 from 2.0 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 9e887ecc..834262de 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,7 @@ unidecode python-dateutil==2.7.3 whoosh==2.7.4 pygments==2.2.0 -django==2.0 +django==2.1.15 django-ajax-selects==1.7.0 django-haystack==2.8.1 django-contrib-comments==1.8.0 -- GitLab