Skip to content

Commit

Permalink
updated for django 3.x
Browse files Browse the repository at this point in the history
  • Loading branch information
faxad committed Apr 14, 2021
1 parent c5b3e34 commit 90ac846
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 24 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ What is an ActivFlow workflow?
![alt tag](https://user-images.githubusercontent.com/6130967/28086399-5625a4e8-6698-11e7-8a00-ccf3180d70be.png)

### Technology Stack
- Python 2.7x, 3.4x, 3.5x, 3.6x
- Django 1.9x, 1.10x, 1.11x
- Python 3.5+
- Django 3.x
- Bootstrap 3.x

### Usage & Configuration
Expand Down
13 changes: 7 additions & 6 deletions activflow/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
CharField,
DateTimeField,
OneToOneField,
ForeignKey)
ForeignKey,
CASCADE)

from activflow.core.constants import (
REQUEST_STATUS,
Expand Down Expand Up @@ -55,17 +56,17 @@ def __unicode__(self):

class Request(AbstractEntity):
"""Defines the workflow request"""
requester = ForeignKey(User, related_name='requests')
requester = ForeignKey(User, related_name='requests', on_delete=CASCADE)
module_ref = CharField(max_length=100)
status = CharField(
verbose_name="Status", max_length=30, choices=REQUEST_STATUS)


class Task(AbstractEntity):
"""Defines the workflow task"""
request = ForeignKey(Request, related_name='tasks')
assignee = ForeignKey(Group)
updated_by = ForeignKey(User)
request = ForeignKey(Request, related_name='tasks', on_delete=CASCADE)
assignee = ForeignKey(Group, on_delete=CASCADE)
updated_by = ForeignKey(User, on_delete=CASCADE)
activity_ref = CharField(max_length=100)
status = CharField(
verbose_name="Status", max_length=30, choices=TASK_STATUS)
Expand Down Expand Up @@ -167,7 +168,7 @@ def rollback(self):

class AbstractActivity(AbstractEntity):
"""Common attributes for all activities"""
task = OneToOneField(Task, null=True)
task = OneToOneField(Task, null=True, on_delete=CASCADE)

class Meta(object):
abstract = True
Expand Down
4 changes: 2 additions & 2 deletions activflow/core/templatetags/core_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def label_with_class(value, arg):
return value.label_tag(attrs={'class': arg})


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


@register.assignment_tag(takes_context=True)
@register.simple_tag(takes_context=True)
def wysiwyg_form_fields(context):
"""Returns activity data as in field/value pair"""
app = context['app_title']
Expand Down
2 changes: 1 addition & 1 deletion activflow/core/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from django.contrib.auth.decorators import login_required
from django.contrib.auth.mixins import LoginRequiredMixin
from django.core.urlresolvers import reverse, reverse_lazy
from django.urls import reverse, reverse_lazy
from django.db import transaction
from django.http import HttpResponseRedirect
from django.shortcuts import render
Expand Down
7 changes: 3 additions & 4 deletions activflow/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

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

ALLOWED_HOSTS = []
ALLOWED_HOSTS = ['activflow']

# Application definition

Expand All @@ -20,15 +20,14 @@
'activflow.tests'
)

MIDDLEWARE_CLASSES = (
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.auth.middleware.SessionAuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
)

ROOT_URLCONF = 'activflow.urls'
Expand Down
1 change: 1 addition & 0 deletions activflow/settings/staging.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'postgres',
'USER': 'postgres',
'PASSWORD': 'password',
'HOST': 'db',
'PORT': 5432,
}
Expand Down
7 changes: 4 additions & 3 deletions activflow/tests/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
CharField,
ForeignKey,
IntegerField,
TextField)
TextField,
CASCADE)

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

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

class FooMoreLineItem(AbstractEntity):
"""Sample representation of FooMore Line Item"""
foo = ForeignKey(Foo, related_name="morelines")
foo = ForeignKey(Foo, related_name="morelines", on_delete=CASCADE)
plughmore = CharField(
"Plughmore", max_length=200, validators=[validate_initial_cap])
thudmore = CharField(verbose_name="Thudmore", max_length=30, choices=(
Expand Down
3 changes: 2 additions & 1 deletion activflow/tests/tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Tests for Core app"""
from django.contrib.auth.models import User, Group
from django.core.urlresolvers import reverse
from django.urls import reverse

from django.test import TestCase
from django.test import Client

Expand Down
2 changes: 1 addition & 1 deletion activflow/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^admin/', admin.site.urls),
url(r'^auth/', include('django.contrib.auth.urls')),
url(r'', include('activflow.core.urls')),
]
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ services:
db:
image: postgres
hostname: db
environment:
- POSTGRES_PASSWORD=password
networks:
activflow-net:
app:
Expand Down
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Django==1.9
gunicorn==19.6.0
psycopg2==2.7.5
django_extensions==1.7.9
Django==3.2
gunicorn==20.1.0
psycopg2==2.8.6
django_extensions==3.1.2

0 comments on commit 90ac846

Please sign in to comment.