Skip to content

Commit

Permalink
Merge pull request #24 from FutureProofGames/feature/DPK-51
Browse files Browse the repository at this point in the history
Upgrade to Django 3
  • Loading branch information
averymd authored Jan 9, 2021
2 parents 9b66c9a + aeaf6e4 commit 2f02a20
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 25 deletions.
9 changes: 8 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
language: python
env:
PYTHONPATH: .
matrix:
- DJANGO='>=3.1,<3.2'
- DJANGO='>=3.0,<3.1'
- DJANGO='>=2.2,<3.0'
python:
- "3.6.8"
- 3.8
- 3.7
- 3.6
install:
- pip install -r requirements.txt
- pip install coverage coveralls
- pip install --pre django$DJANGO
- pip install .
script:
- coverage run --source=django_presskit runtests.py
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ A port of Rami Ismail's [presskit()/dopresskit](https://github.com/ramiismail/do

### Requirements:

* Django < 2
* Django>=2.2
* django-filer
* easy_thumbnails
* Markdown
Expand Down Expand Up @@ -70,6 +70,10 @@ If you're using nginx and one of your slugs has more than ten underscores, add a

## Changelog

### 1.3.0

* Add support for Django 2 and 3, drop support for Django 1

### 1.2.0

* Upgrade to support Python 3.6+
Expand Down
38 changes: 23 additions & 15 deletions django_presskit/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __str__(self):
return self.title + ' ' + self.website

class Attachment(models.Model):
content = FilerImageField()
content = FilerImageField(on_delete=models.CASCADE)

def __str__(self):
return self.content.url
Expand All @@ -47,7 +47,8 @@ class Company(models.Model):
slug = models.SlugField(unique=True)
website = models.URLField(null=True, blank=True)
header_image = FilerImageField(null=True, blank=True,
related_name='company_header_image')
related_name='company_header_image',
on_delete=models.SET_NULL)
based_in = models.CharField(max_length=400, null=True, blank=True)
description = models.TextField(null=True, blank=True)
history = models.TextField(null=True, blank=True)
Expand All @@ -74,7 +75,8 @@ class Company(models.Model):
contacts = models.ManyToManyField('Contact', blank=True)
datetime_created = models.DateTimeField(auto_now_add=True)
datetime_updated = models.DateTimeField(auto_now=True)
asset_archive = FilerFileField(blank=True,null=True)
asset_archive = FilerFileField(blank=True, null=True,
on_delete=models.SET_NULL)

def __str__(self):
return self.title
Expand Down Expand Up @@ -113,10 +115,11 @@ class Meta(object):

class CompanyVideo(models.Model):
name = models.CharField(max_length=400)
company = models.ForeignKey(Company, related_name='videos')
company = models.ForeignKey(Company, related_name='videos', on_delete=models.CASCADE)
embed_url = models.URLField(null=True, blank=True)
file = FilerFileField(null=True, blank=True,
related_name='company_video')
related_name='company_video',
on_delete=models.SET_NULL)
datetime_created = models.DateTimeField(auto_now_add=True)
datetime_updated = models.DateTimeField(auto_now=True)
my_order = models.PositiveIntegerField(default=0, blank=False, null=False)
Expand Down Expand Up @@ -157,7 +160,7 @@ def __str__(self):

class Feature(models.Model):
description = models.CharField(max_length=1000)
project = models.ForeignKey('Project')
project = models.ForeignKey('Project', on_delete=models.CASCADE)
datetime_created = models.DateTimeField(auto_now_add=True)
datetime_updated = models.DateTimeField(auto_now=True)
my_order = models.PositiveIntegerField(default=0, blank=False, null=False)
Expand All @@ -182,7 +185,7 @@ def __str__(self):
class Platform(models.Model):
name = models.CharField(max_length=200)
website = models.URLField(null=True, blank=True)
project = models.ForeignKey('Project')
project = models.ForeignKey('Project', on_delete=models.CASCADE)
datetime_created = models.DateTimeField(auto_now_add=True)
datetime_updated = models.DateTimeField(auto_now=True)
my_order = models.PositiveIntegerField(default=0, blank=False, null=False)
Expand All @@ -196,7 +199,7 @@ def __str__(self):

class Price(models.Model):
price = models.CharField(max_length=200)
project = models.ForeignKey('Project')
project = models.ForeignKey('Project', on_delete=models.CASCADE)
datetime_created = models.DateTimeField(auto_now_add=True)
datetime_updated = models.DateTimeField(auto_now=True)
my_order = models.PositiveIntegerField(default=0, blank=False, null=False)
Expand All @@ -212,7 +215,8 @@ class Project(models.Model):
title = models.CharField(max_length=200)
slug = models.SlugField(unique=True)
header_image = FilerImageField(null=True, blank=True,
related_name='project_header_image')
related_name='project_header_image',
on_delete=models.SET_NULL)
release_date = models.CharField(max_length=200)
website = models.URLField()
description = models.TextField()
Expand All @@ -224,7 +228,8 @@ class Project(models.Model):
through='ProjectLogoAttachment',
related_name='project_logos')
press_can_request_copy = models.BooleanField()
monetization_permission = models.ForeignKey(MonetizationPermission)
monetization_permission = models.ForeignKey(MonetizationPermission,
on_delete=models.CASCADE)
distribute_game_id = models.CharField(
null=True, blank=True, max_length=25, help_text='The game ID from your Distribute() keyfile (https://dodistribute.com/games/presskit/THIS-ID/)')
distribute_access_hash = models.CharField(
Expand All @@ -237,10 +242,11 @@ class Project(models.Model):
awards = models.ManyToManyField('Award', blank=True)
credits = models.ManyToManyField(Credit, blank=True)
contacts = models.ManyToManyField(Contact, blank=True)
company = models.ForeignKey(Company)
company = models.ForeignKey(Company, on_delete=models.CASCADE)
datetime_created = models.DateTimeField(auto_now_add=True)
datetime_updated = models.DateTimeField(auto_now=True)
asset_archive = FilerFileField(blank=True,null=True)
asset_archive = FilerFileField(blank=True, null=True,
on_delete=models.SET_NULL)
my_order = models.PositiveIntegerField(default=0, blank=False, null=False)

class Meta(object):
Expand Down Expand Up @@ -297,7 +303,7 @@ def __str__(self):
class Social(models.Model):
name = models.CharField(max_length=200)
website = models.URLField()
company = models.ForeignKey(Company)
company = models.ForeignKey(Company, on_delete=models.CASCADE)
datetime_created = models.DateTimeField(auto_now_add=True)
datetime_updated = models.DateTimeField(auto_now=True)
my_order = models.PositiveIntegerField(default=0, blank=False, null=False)
Expand All @@ -312,9 +318,11 @@ def __str__(self):
class Trailer(models.Model):
name = models.CharField(max_length=400)
embed_url = models.URLField(null=True, blank=True)
project = models.ForeignKey(Project, related_name='videos')
project = models.ForeignKey(Project, related_name='videos',
on_delete=models.CASCADE)
file = FilerFileField(null=True, blank=True,
related_name='trailer_video')
related_name='trailer_video',
on_delete=models.SET_NULL)
datetime_created = models.DateTimeField(auto_now_add=True)
datetime_updated = models.DateTimeField(auto_now=True)
my_order = models.PositiveIntegerField(default=0, blank=False, null=False)
Expand Down
1 change: 1 addition & 0 deletions django_presskit/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from . import views

app_name = 'presskit'
urlpatterns = [
url(r'^$', views.presskit, name='default'),
url(r'^(?P<company_slug>[-\w]+)/$', views.presskit, name='company'),
Expand Down
14 changes: 8 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
Django==1.11.29
django-filer==1.4.0
easy_thumbnails==2.5
Markdown==2.6.11
Pillow==6.2.0
coverage==4.4.2
django-admin-sortable2==0.7.7
django-filer==2.0.2
django-polymorphic==3.0.0
Django==3.1.4
easy_thumbnails==2.7.1
future==0.18.2
django-admin-sortable2==0.7
Markdown==2.6.11
Pillow==7.1.0
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="django_presskit",
version="1.2.0",
version="1.3.0",
author="Future Proof Games",
author_email="info@futureproofgames.com",
description="A port of presskit() to Django",
Expand All @@ -16,7 +16,7 @@
include_package_data=True,
classifiers=[
"Programming Language :: Python :: 3.7",
"Framework :: Django :: 1.11",
"Framework :: Django :: 2.2",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: OS Independent",
],
Expand Down
17 changes: 17 additions & 0 deletions tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sites",
"django.contrib.messages",
"tests",
"django_presskit",
"easy_thumbnails",
"filer",
"adminsortable2",
"django.contrib.admin",
]

DATABASES = {
Expand All @@ -19,12 +21,27 @@

ROOT_URLCONF = "tests.urls"

MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.request',
'django.contrib.messages.context_processors.messages',
]
},
},
]

0 comments on commit 2f02a20

Please sign in to comment.