Skip to content

Commit 90ac846

Browse files
committed
updated for django 3.x
1 parent c5b3e34 commit 90ac846

File tree

11 files changed

+29
-24
lines changed

11 files changed

+29
-24
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ What is an ActivFlow workflow?
1818
![alt tag](https://user-images.githubusercontent.com/6130967/28086399-5625a4e8-6698-11e7-8a00-ccf3180d70be.png)
1919

2020
### Technology Stack
21-
- Python 2.7x, 3.4x, 3.5x, 3.6x
22-
- Django 1.9x, 1.10x, 1.11x
21+
- Python 3.5+
22+
- Django 3.x
2323
- Bootstrap 3.x
2424

2525
### Usage & Configuration

activflow/core/models.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
CharField,
77
DateTimeField,
88
OneToOneField,
9-
ForeignKey)
9+
ForeignKey,
10+
CASCADE)
1011

1112
from activflow.core.constants import (
1213
REQUEST_STATUS,
@@ -55,17 +56,17 @@ def __unicode__(self):
5556

5657
class Request(AbstractEntity):
5758
"""Defines the workflow request"""
58-
requester = ForeignKey(User, related_name='requests')
59+
requester = ForeignKey(User, related_name='requests', on_delete=CASCADE)
5960
module_ref = CharField(max_length=100)
6061
status = CharField(
6162
verbose_name="Status", max_length=30, choices=REQUEST_STATUS)
6263

6364

6465
class Task(AbstractEntity):
6566
"""Defines the workflow task"""
66-
request = ForeignKey(Request, related_name='tasks')
67-
assignee = ForeignKey(Group)
68-
updated_by = ForeignKey(User)
67+
request = ForeignKey(Request, related_name='tasks', on_delete=CASCADE)
68+
assignee = ForeignKey(Group, on_delete=CASCADE)
69+
updated_by = ForeignKey(User, on_delete=CASCADE)
6970
activity_ref = CharField(max_length=100)
7071
status = CharField(
7172
verbose_name="Status", max_length=30, choices=TASK_STATUS)
@@ -167,7 +168,7 @@ def rollback(self):
167168

168169
class AbstractActivity(AbstractEntity):
169170
"""Common attributes for all activities"""
170-
task = OneToOneField(Task, null=True)
171+
task = OneToOneField(Task, null=True, on_delete=CASCADE)
171172

172173
class Meta(object):
173174
abstract = True

activflow/core/templatetags/core_tags.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def label_with_class(value, arg):
2424
return value.label_tag(attrs={'class': arg})
2525

2626

27-
@register.assignment_tag(takes_context=True)
27+
@register.simple_tag(takes_context=True)
2828
def activity_data(context, instance, option, _type):
2929
"""Returns activity data as in field/value pair"""
3030
app = context['app_title']
@@ -95,7 +95,7 @@ def get_all_fields(instance, exclude=None):
9595
return related_model_fields
9696

9797

98-
@register.assignment_tag(takes_context=True)
98+
@register.simple_tag(takes_context=True)
9999
def wysiwyg_form_fields(context):
100100
"""Returns activity data as in field/value pair"""
101101
app = context['app_title']

activflow/core/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from django.contrib.auth.decorators import login_required
44
from django.contrib.auth.mixins import LoginRequiredMixin
5-
from django.core.urlresolvers import reverse, reverse_lazy
5+
from django.urls import reverse, reverse_lazy
66
from django.db import transaction
77
from django.http import HttpResponseRedirect
88
from django.shortcuts import render

activflow/settings/base.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
SECRET_KEY = 'test_s*kbi04s%5u921e+d52kaa(e=d)%i4w@s6a6u8-x&bij^l8!q-'
66

7-
ALLOWED_HOSTS = []
7+
ALLOWED_HOSTS = ['activflow']
88

99
# Application definition
1010

@@ -20,15 +20,14 @@
2020
'activflow.tests'
2121
)
2222

23-
MIDDLEWARE_CLASSES = (
23+
MIDDLEWARE = (
24+
'django.middleware.security.SecurityMiddleware',
2425
'django.contrib.sessions.middleware.SessionMiddleware',
2526
'django.middleware.common.CommonMiddleware',
2627
'django.middleware.csrf.CsrfViewMiddleware',
2728
'django.contrib.auth.middleware.AuthenticationMiddleware',
28-
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
2929
'django.contrib.messages.middleware.MessageMiddleware',
3030
'django.middleware.clickjacking.XFrameOptionsMiddleware',
31-
'django.middleware.security.SecurityMiddleware',
3231
)
3332

3433
ROOT_URLCONF = 'activflow.urls'

activflow/settings/staging.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
'ENGINE': 'django.db.backends.postgresql',
1010
'NAME': 'postgres',
1111
'USER': 'postgres',
12+
'PASSWORD': 'password',
1213
'HOST': 'db',
1314
'PORT': 5432,
1415
}

activflow/tests/models.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
CharField,
55
ForeignKey,
66
IntegerField,
7-
TextField)
7+
TextField,
8+
CASCADE)
89

910
from activflow.core.models import (
1011
AbstractEntity,
@@ -28,7 +29,7 @@ def clean(self):
2829

2930
class FooLineItem(AbstractEntity):
3031
"""Sample representation of Foo Line Item"""
31-
foo = ForeignKey(Foo, related_name="lines")
32+
foo = ForeignKey(Foo, related_name="lines", on_delete=CASCADE)
3233
plugh = CharField(
3334
"Plugh", max_length=200, validators=[validate_initial_cap])
3435
thud = CharField(verbose_name="Thud", max_length=30, choices=(
@@ -46,7 +47,7 @@ def clean(self):
4647

4748
class FooMoreLineItem(AbstractEntity):
4849
"""Sample representation of FooMore Line Item"""
49-
foo = ForeignKey(Foo, related_name="morelines")
50+
foo = ForeignKey(Foo, related_name="morelines", on_delete=CASCADE)
5051
plughmore = CharField(
5152
"Plughmore", max_length=200, validators=[validate_initial_cap])
5253
thudmore = CharField(verbose_name="Thudmore", max_length=30, choices=(

activflow/tests/tests.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Tests for Core app"""
22
from django.contrib.auth.models import User, Group
3-
from django.core.urlresolvers import reverse
3+
from django.urls import reverse
4+
45
from django.test import TestCase
56
from django.test import Client
67

activflow/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
urlpatterns = [
8-
url(r'^admin/', include(admin.site.urls)),
8+
url(r'^admin/', admin.site.urls),
99
url(r'^auth/', include('django.contrib.auth.urls')),
1010
url(r'', include('activflow.core.urls')),
1111
]

docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ services:
44
db:
55
image: postgres
66
hostname: db
7+
environment:
8+
- POSTGRES_PASSWORD=password
79
networks:
810
activflow-net:
911
app:

0 commit comments

Comments
 (0)