Skip to content

Commit

Permalink
Upgrade to Django 2.2. (#1830)
Browse files Browse the repository at this point in the history
* Upgrade to Django 2.2.

Update dependencies for django 2.2 compatibility

* Fix Github Action PostgreSQL config
  • Loading branch information
luzfcb authored Sep 8, 2021
1 parent 8716928 commit 8a02c10
Show file tree
Hide file tree
Showing 91 changed files with 483 additions and 266 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ jobs:
services:
postgres:
image: postgres:10.1
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: pythonorg
ports:
- 5432:5432
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: Check out repository
uses: actions/checkout@v2
Expand All @@ -33,7 +39,7 @@ jobs:
run: |
python -Wd -m coverage run manage.py test -v2
env:
DATABASE_URL: postgres://postgres:@127.0.0.1:5432/python.org
DATABASE_URL: postgres://postgres:postgres@localhost:5432/pythonorg
- name: Coverage
run: |
coverage report -m --fail-under=75
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,9 @@ static/stylesheets/no-mq.css
static/stylesheets/style.css
__pycache__
*.db
*.py[co]
.vscode
.~lock.*
.idea
.coverage
.env
1 change: 1 addition & 0 deletions banners/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
default_app_config = 'banners.apps.BannersAppConfig'
6 changes: 6 additions & 0 deletions banners/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class BannersAppConfig(AppConfig):

name = 'banners'
41 changes: 21 additions & 20 deletions base-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,48 +1,49 @@
dj-database-url==0.5.0
django-pipeline==1.6.14
django-sitetree==1.10.0
Django==2.0.13
django-pipeline==2.0.6
django-sitetree==1.17.0
Django==2.2.24
docutils==0.12
Markdown==3.3.4
cmarkgfm==0.4.2
cmarkgfm==0.6.0
Pillow==8.3.1
psycopg2==2.8.6
python3-openid==3.1.0
python3-openid==3.2.0
python-decouple==3.4
# lxml used by BeautifulSoup.
lxml==4.6.3
cssselect==0.9.1
cssselect==1.1.0
feedparser==6.0.8
beautifulsoup4==4.6.0
icalendar==3.8.4
beautifulsoup4==4.9.3
icalendar==4.0.7
chardet==4.0.0
# TODO: We may drop 'django-imagekit' completely.
django-imagekit==4.0.2
git+https://github.com/django-haystack/django-haystack.git@802b0f6f4b3b99314453261876a32bac2bbec94f
django-haystack==3.0
elasticsearch>=5,<6
# TODO: 0.14.0 only supports Django 1.8 and 1.11.
django-tastypie==0.14.1
django-tastypie==0.14.3

pytz==2017.2
python-dateutil==2.8.1
pytz==2021.1
python-dateutil==2.8.2

requests[security]>=2.26.0

django-honeypot==0.6.0
django-markupfield==1.4.3
django-honeypot==1.0.1
django-markupfield==2.0.0
django-markupfield-helpers==0.1.1

django-allauth==0.41.0

django-waffle==0.14
django-waffle==2.2.1

djangorestframework==3.8.2
django-filter==1.1.0
djangorestframework==3.12.2
django-filter==2.4.0
django-ordered-model==3.4.3
django-widget-tweaks==1.4.8
django-countries==6.1.3
django-countries==7.2.1
xhtml2pdf==0.2.5
django-easy-pdf==0.1.1
django-easy-pdf3==0.1.2
num2words==0.5.10
django-polymorphic==2.1.2
django-polymorphic==3.0.0
sorl-thumbnail==12.7.0
docxtpl==0.12.0
1 change: 1 addition & 0 deletions blogs/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
default_app_config = 'blogs.apps.BlogsAppConfig'
6 changes: 6 additions & 0 deletions blogs/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class BlogsAppConfig(AppConfig):

name = 'blogs'
5 changes: 2 additions & 3 deletions blogs/urls.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from django.conf.urls import url

from . import views
from django.urls import path

urlpatterns = [
url(r'^$', views.BlogHome.as_view(), name='blog'),
path('', views.BlogHome.as_view(), name='blog'),
]
1 change: 1 addition & 0 deletions boxes/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
default_app_config = 'boxes.apps.BoxesAppConfig'
6 changes: 6 additions & 0 deletions boxes/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class BoxesAppConfig(AppConfig):

name = 'boxes'
3 changes: 2 additions & 1 deletion boxes/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@
import factory

from django.conf import settings
from factory.django import DjangoModelFactory

from .models import Box

from users.factories import UserFactory


class BoxFactory(factory.DjangoModelFactory):
class BoxFactory(DjangoModelFactory):

class Meta:
model = Box
Expand Down
5 changes: 2 additions & 3 deletions boxes/urls.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from django.conf.urls import url

from .views import box
from django.urls import path

urlpatterns = [
url(r'(?P<label>[\w-]+)/$', box, name='box'),
path('<slug:label>/', box, name='box'),
]
1 change: 1 addition & 0 deletions cms/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
default_app_config = 'cms.apps.CmsAppConfig'
6 changes: 6 additions & 0 deletions cms/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class CmsAppConfig(AppConfig):

name = 'cms'
1 change: 1 addition & 0 deletions codesamples/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
default_app_config = 'codesamples.apps.CodesamplesAppConfig'
6 changes: 6 additions & 0 deletions codesamples/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class CodesamplesAppConfig(AppConfig):

name = 'codesamples'
3 changes: 2 additions & 1 deletion codesamples/factories.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import textwrap

import factory
from factory.django import DjangoModelFactory

from .models import CodeSample

from users.factories import UserFactory


class CodeSampleFactory(factory.DjangoModelFactory):
class CodeSampleFactory(DjangoModelFactory):

class Meta:
model = CodeSample
Expand Down
1 change: 1 addition & 0 deletions community/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
default_app_config = 'community.apps.CommunityAppConfig'
6 changes: 6 additions & 0 deletions community/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class CommunityAppConfig(AppConfig):

name = 'community'
2 changes: 1 addition & 1 deletion community/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.contrib.postgres.fields import JSONField
from django.urls import reverse
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from markupfield.fields import MarkupField

Expand Down
7 changes: 3 additions & 4 deletions community/urls.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from django.conf.urls import url

from . import views
from django.urls import path

app_name = 'community'
urlpatterns = [
url(r'^$', views.PostList.as_view(), name='post_list'),
url(r'^(?P<pk>\d+)/$', views.PostDetail.as_view(), name='post_detail'),
path('', views.PostList.as_view(), name='post_list'),
path('<int:pk>/', views.PostDetail.as_view(), name='post_detail'),
]
1 change: 1 addition & 0 deletions companies/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
default_app_config = 'companies.apps.CompaniesAppConfig'
6 changes: 6 additions & 0 deletions companies/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class CompaniesAppConfig(AppConfig):

name = 'companies'
3 changes: 2 additions & 1 deletion companies/factories.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import factory
from factory.django import DjangoModelFactory

from .models import Company


class CompanyFactory(factory.DjangoModelFactory):
class CompanyFactory(DjangoModelFactory):

class Meta:
model = Company
Expand Down
2 changes: 1 addition & 1 deletion companies/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.conf import settings
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from markupfield.fields import MarkupField

from cms.models import NameSlugModel
Expand Down
8 changes: 4 additions & 4 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

# Required for running tests

factory-boy==2.9.2
factory-boy==3.1.0
Faker==0.8.1
tblib==1.7.0
responses==0.10.5
responses==0.13.3

# Extra stuff required for local dev

django-debug-toolbar==1.9.1
django-debug-toolbar==3.2.1
coverage
ddt
model-bakery==1.2.0
model-bakery==1.3.2
1 change: 1 addition & 0 deletions downloads/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
default_app_config = 'downloads.apps.DownloadsAppConfig'
6 changes: 3 additions & 3 deletions downloads/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,15 @@ class OSViewSet(viewsets.ModelViewSet):
serializer_class = OSSerializer
authentication_classes = (TokenAuthentication,)
permission_classes = (IsStaffOrReadOnly,)
filter_fields = ('name', 'slug')
filterset_fields = ('name', 'slug')


class ReleaseViewSet(BaseAPIViewSet):
model = Release
serializer_class = ReleaseSerializer
authentication_classes = (TokenAuthentication,)
permission_classes = (IsStaffOrReadOnly,)
filter_fields = (
filterset_fields = (
'name',
'slug',
'is_published',
Expand Down Expand Up @@ -123,7 +123,7 @@ class ReleaseFileViewSet(viewsets.ModelViewSet):
serializer_class = ReleaseFileSerializer
authentication_classes = (TokenAuthentication,)
permission_classes = (IsStaffOrReadOnly,)
filter_class = ReleaseFileFilter
filterset_class = ReleaseFileFilter

@action(detail=False, methods=['delete'])
def delete_by_release(self, request):
Expand Down
6 changes: 6 additions & 0 deletions downloads/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class DownloadsAppConfig(AppConfig):

name = 'downloads'
7 changes: 4 additions & 3 deletions downloads/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

import factory
import requests
from factory.django import DjangoModelFactory

from users.factories import UserFactory

from .models import OS, Release, ReleaseFile


class OSFactory(factory.DjangoModelFactory):
class OSFactory(DjangoModelFactory):

class Meta:
model = OS
Expand All @@ -17,7 +18,7 @@ class Meta:
creator = factory.SubFactory(UserFactory)


class ReleaseFactory(factory.DjangoModelFactory):
class ReleaseFactory(DjangoModelFactory):

class Meta:
model = Release
Expand All @@ -27,7 +28,7 @@ class Meta:
is_published = True


class ReleaseFileFactory(factory.DjangoModelFactory):
class ReleaseFileFactory(DjangoModelFactory):

class Meta:
model = ReleaseFile
Expand Down
14 changes: 7 additions & 7 deletions downloads/urls.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from django.conf.urls import url
from . import views
from django.urls import path, re_path

app_name = 'downloads'
urlpatterns = [
url(r'latest/python2/?$', views.DownloadLatestPython2.as_view(), name='download_latest_python2'),
url(r'latest/python3/?$', views.DownloadLatestPython3.as_view(), name='download_latest_python3'),
url(r'operating-systems/$', views.DownloadFullOSList.as_view(), name='download_full_os_list'),
url(r'release/(?P<release_slug>[-_\w]+)/$', views.DownloadReleaseDetail.as_view(), name='download_release_detail'),
url(r'(?P<slug>[-_\w]+)/$', views.DownloadOSList.as_view(), name='download_os_list'),
url(r'$', views.DownloadHome.as_view(), name='download'),
re_path(r'latest/python2/?$', views.DownloadLatestPython2.as_view(), name='download_latest_python2'),
re_path(r'latest/python3/?$', views.DownloadLatestPython3.as_view(), name='download_latest_python3'),
path('operating-systems/', views.DownloadFullOSList.as_view(), name='download_full_os_list'),
path('release/<slug:release_slug>/', views.DownloadReleaseDetail.as_view(), name='download_release_detail'),
path('<slug:slug>/', views.DownloadOSList.as_view(), name='download_os_list'),
path('', views.DownloadHome.as_view(), name='download'),
]
Loading

0 comments on commit 8a02c10

Please sign in to comment.