Skip to content
Snippets Groups Projects
Commit ec05f9fd authored by Todd Dembrey's avatar Todd Dembrey Committed by George Hickman
Browse files

Add the document category model and integrate into the page (#1370)

* Add the document category model and integrate into the page

* Fix document category migration tree
parent 0c0971d0
No related branches found
No related tags found
No related merge requests found
from wagtail.contrib.modeladmin.options import ModelAdmin, ModelAdminGroup
from .models import DocumentCategory
class DocumentCategoryAdmin(ModelAdmin):
model = DocumentCategory
menu_icon = 'doc-full'
list_display = ('name', 'recommended_minimum',)
class ManageAdminGoup(ModelAdminGroup):
menu_label = 'Manage'
menu_icon = 'folder-open-inverse'
items = (
DocumentCategoryAdmin,
)
# Generated by Django 2.0.13 on 2019-08-06 22:08
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('application_projects', '0008_add_value_validator'),
]
operations = [
migrations.CreateModel(
name='DocumentCategory',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=254)),
('recommended_minimum', models.PositiveIntegerField()),
],
options={
'ordering': ('name',),
'verbose_name_plural': 'Document Categories',
},
),
]
......@@ -78,3 +78,15 @@ class Project(models.Model):
def get_absolute_url(self):
return reverse('apply:projects:detail', args=[self.id])
class DocumentCategory(models.Model):
name = models.CharField(max_length=254)
recommended_minimum = models.PositiveIntegerField()
def __str__(self):
return self.name
class Meta:
ordering = ('name',)
verbose_name_plural = 'Document Categories'
......@@ -41,7 +41,18 @@
<div class="docs-block__row-inner">
<a data-fancybox data-src="#upload-supporting-doc" class="docs-block__link" href="#">Upload new</a>
</div>
<p class="docs-block__info-text">Every project requires a XXXXXX and XXXXXX to be uploaded</p>
{% if remaining_document_categories %}
<div class="docs-block__info-text">
<p>
Every project should include the following documents:
</p>
<ul>
{% for category in remaining_document_categories %}
<li>{{ category.name }} ({{ category.recommended_minimum }})</li>
{% endfor %}
</ul>
</div>
{% endif %}
<!-- Example document list
<ul class="docs-block__document-list">
<li class="docs-block__document">
......
......@@ -10,7 +10,7 @@ from opentech.apply.utils.views import (DelegateableView, DelegatedViewMixin,
ViewDispatcher)
from .forms import ProjectEditForm, UpdateProjectLeadForm
from .models import Project
from .models import Project, DocumentCategory
@method_decorator(staff_required, name='dispatch')
......@@ -44,6 +44,12 @@ class AdminProjectDetailView(ActivityContextMixin, DelegateableView, DetailView)
model = Project
template_name_suffix = '_admin_detail'
def get_context_data(self, **kwargs):
return super().get_context_data(
remaining_document_categories=DocumentCategory.objects.all(),
**kwargs,
)
class ApplicantProjectDetailView(DetailView):
model = Project
......
from wagtail.contrib.modeladmin.options import modeladmin_register
from .admin import ManageAdminGoup
modeladmin_register(ManageAdminGoup)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment