From 031f42407e79fa721b41d85bb37f028329431224 Mon Sep 17 00:00:00 2001 From: Todd Dembrey <todd.dembrey@torchbox.com> Date: Mon, 22 Jan 2018 16:58:27 +0000 Subject: [PATCH] Create a very basic listing of the Application Submissions --- opentech/apply/dashboard/__init__.py | 0 opentech/apply/dashboard/apps.py | 5 ++++ .../apply/dashboard/migrations/__init__.py | 0 opentech/apply/dashboard/models.py | 3 ++ .../templates/dashboard/dashboard.html | 17 +++++++++++ opentech/apply/dashboard/urls.py | 8 +++++ opentech/apply/dashboard/views.py | 8 +++++ .../migrations/0005_applicationsubmission.py | 30 +++++++++++++++++++ opentech/apply/funds/models.py | 8 +++++ opentech/apply/urls.py | 3 ++ opentech/settings/base.py | 1 + 11 files changed, 83 insertions(+) create mode 100644 opentech/apply/dashboard/__init__.py create mode 100644 opentech/apply/dashboard/apps.py create mode 100644 opentech/apply/dashboard/migrations/__init__.py create mode 100644 opentech/apply/dashboard/models.py create mode 100644 opentech/apply/dashboard/templates/dashboard/dashboard.html create mode 100644 opentech/apply/dashboard/urls.py create mode 100644 opentech/apply/dashboard/views.py create mode 100644 opentech/apply/funds/migrations/0005_applicationsubmission.py diff --git a/opentech/apply/dashboard/__init__.py b/opentech/apply/dashboard/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/opentech/apply/dashboard/apps.py b/opentech/apply/dashboard/apps.py new file mode 100644 index 000000000..50878e766 --- /dev/null +++ b/opentech/apply/dashboard/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class DashboardConfig(AppConfig): + name = 'dashboard' diff --git a/opentech/apply/dashboard/migrations/__init__.py b/opentech/apply/dashboard/migrations/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/opentech/apply/dashboard/models.py b/opentech/apply/dashboard/models.py new file mode 100644 index 000000000..0b4331b36 --- /dev/null +++ b/opentech/apply/dashboard/models.py @@ -0,0 +1,3 @@ +# from django.db import models + +# Create your models here. diff --git a/opentech/apply/dashboard/templates/dashboard/dashboard.html b/opentech/apply/dashboard/templates/dashboard/dashboard.html new file mode 100644 index 000000000..bdfa001e5 --- /dev/null +++ b/opentech/apply/dashboard/templates/dashboard/dashboard.html @@ -0,0 +1,17 @@ +{% extends "base.html" %} + +{% block content %} +<h1>Recieved Content</h1> +<h3>Track and explore recent submissions</h3> +<table> +{% for submission in applicationsubmission_list %} + <tr> + <td> + {{ submission }} + </td> + </tr> +{% empty %} + There are no submissions to review. +{% endfor %} +</table> +{% endblock %} diff --git a/opentech/apply/dashboard/urls.py b/opentech/apply/dashboard/urls.py new file mode 100644 index 000000000..b5bfdcafa --- /dev/null +++ b/opentech/apply/dashboard/urls.py @@ -0,0 +1,8 @@ +from django.conf.urls import url + +from .views import DashboardView + + +urlpatterns = [ + url(r'^$', DashboardView.as_view(), name="dashboard") +] diff --git a/opentech/apply/dashboard/views.py b/opentech/apply/dashboard/views.py new file mode 100644 index 000000000..c303a7717 --- /dev/null +++ b/opentech/apply/dashboard/views.py @@ -0,0 +1,8 @@ +from django.views.generic import ListView + +from opentech.apply.funds.models import ApplicationSubmission + + +class DashboardView(ListView): + model = ApplicationSubmission + template_name = 'dashboard/dashboard.html' diff --git a/opentech/apply/funds/migrations/0005_applicationsubmission.py b/opentech/apply/funds/migrations/0005_applicationsubmission.py new file mode 100644 index 000000000..f2c19d924 --- /dev/null +++ b/opentech/apply/funds/migrations/0005_applicationsubmission.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.11.8 on 2018-01-22 09:40 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('wagtailcore', '0040_page_draft_title'), + ('funds', '0004_categoryblock_add_required_option'), + ] + + operations = [ + migrations.CreateModel( + name='ApplicationSubmission', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('form_data', models.TextField()), + ('submit_time', models.DateTimeField(auto_now_add=True, verbose_name='submit time')), + ('page', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='wagtailcore.Page')), + ], + options={ + 'verbose_name': 'form submission', + 'abstract': False, + }, + ), + ] diff --git a/opentech/apply/funds/models.py b/opentech/apply/funds/models.py index 9f575ea6a..64cf0ccc5 100644 --- a/opentech/apply/funds/models.py +++ b/opentech/apply/funds/models.py @@ -17,6 +17,7 @@ from wagtail.wagtailadmin.edit_handlers import ( ) from wagtail.wagtailcore.fields import StreamField from wagtail.wagtailcore.models import Orderable +from wagtail.wagtailforms.models import AbstractFormSubmission from opentech.apply.stream_forms.models import AbstractStreamForm @@ -52,6 +53,9 @@ class FundType(AbstractStreamForm): # Only return the first form, will need updating for when working with 2 stage WF return self.forms.all()[0].fields + def get_submission_class(self): + return ApplicationSubmission + @property def workflow_class(self): return WORKFLOW_CLASS[self.get_workflow_display()] @@ -182,3 +186,7 @@ class Round(AbstractStreamForm): # We hide the round as only the open round is used which is displayed through the # fund page raise Http404() + + +class ApplicationSubmission(AbstractFormSubmission): + pass diff --git a/opentech/apply/urls.py b/opentech/apply/urls.py index 4624990d0..802e5c0fc 100644 --- a/opentech/apply/urls.py +++ b/opentech/apply/urls.py @@ -2,8 +2,11 @@ from django.conf.urls import include, url from .funds import urls as funds_urls from .users import urls as users_urls +from .dashboard import urls as dashboard_urls + urlpatterns = [ url(r'^apply/', include(funds_urls)), url(r'^account/', include(users_urls, namespace='users')), + url(r'^dashboard/', include(dashboard_urls, namespace='dashboard')), ] diff --git a/opentech/settings/base.py b/opentech/settings/base.py index 38c958902..8ba4b2de0 100644 --- a/opentech/settings/base.py +++ b/opentech/settings/base.py @@ -16,6 +16,7 @@ INSTALLED_APPS = [ 'opentech.apply.categories', 'opentech.apply.funds', + 'opentech.apply.dashboard', 'opentech.apply.home', 'opentech.apply.users', 'opentech.apply.stream_forms', -- GitLab