continue documents and processes templates
This commit is contained in:
parent
8679915ca7
commit
b386357ebf
|
@ -21,4 +21,5 @@ urlpatterns = [
|
|||
url(r'^admin/', admin.site.urls),
|
||||
url(r'^docs/', include('evolus.urls')),
|
||||
url(r'^jci/', include('jci.urls')),
|
||||
url(r'^p/', include('process.urls')),
|
||||
]
|
||||
|
|
BIN
db.sqlite3
BIN
db.sqlite3
Binary file not shown.
|
@ -0,0 +1,5 @@
|
|||
from ..models import Version
|
||||
|
||||
from django import template
|
||||
|
||||
register = template.Library()
|
|
@ -1,8 +1,9 @@
|
|||
from django.conf.urls import url
|
||||
|
||||
from evolus.views import filter_documents
|
||||
from evolus.views import document_details, filter_documents
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
url(r'd/(?P<pk>\d+)', document_details, name='document_details'),
|
||||
url(r'filter', filter_documents, name='filter_documents'),
|
||||
]
|
||||
|
|
|
@ -1,8 +1,18 @@
|
|||
from django.shortcuts import render
|
||||
from .models import Version
|
||||
from .models import Document, Version
|
||||
from .filters import VersionFilter
|
||||
|
||||
|
||||
def documents_list(request):
|
||||
docs = Document.objects.all()
|
||||
return render(request, 'evolus/documents_list.html', {'documents': docs})
|
||||
|
||||
|
||||
def document_details(request, pk):
|
||||
doc = Document.objects.get(pk=pk)
|
||||
return render(request, 'evolus/document_details.html', {'document': doc})
|
||||
|
||||
|
||||
def filter_documents(request):
|
||||
f = VersionFilter(request.GET, queryset=Version.objects.all())
|
||||
return render(request, 'evolus/search.html', {'filter': f })
|
||||
f = VersionFilter(request.GET, queryset=Version.objects.select_related('document').all())
|
||||
return render(request, 'evolus/filters.html', {'filter': f})
|
||||
|
|
|
@ -10,8 +10,8 @@ def jci_list(request):
|
|||
|
||||
def get_intent(request, intent_id):
|
||||
intent = Intent.objects.prefetch_related('standards').get(pk=intent_id)
|
||||
return render(request, 'jci/intent/details.html', {'intent':intent})
|
||||
return render(request, 'jci/intent/details.html', {'intent': intent})
|
||||
|
||||
def get_standard(request, standard_id):
|
||||
standard = Standard.objects.select_related('intent').select_related('headline').get(pk=standard_id)
|
||||
return render(request, 'jci/standard/details.html', {'standard':standard})
|
||||
return render(request, 'jci/standard/details.html', {'standard': standard})
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.5 on 2017-10-31 09:14
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.utils.timezone
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('process', '0004_remove_process_process_type'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='process',
|
||||
name='created_at',
|
||||
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
|
||||
preserve_default=False,
|
||||
),
|
||||
]
|
|
@ -4,7 +4,8 @@ from django.contrib.auth.models import User
|
|||
|
||||
|
||||
class Process(models.Model):
|
||||
document_version = models.ForeignKey('evolus.Version')
|
||||
document_version = models.ForeignKey('evolus.Version', related_name='processes')
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
def percentage_of_completion(self):
|
||||
total = self.tasks.count()
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
from django.conf.urls import url
|
||||
|
||||
from .views import process_details
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
url(r'process/(?P<pk>\d+)', process_details, name='process_details'),
|
||||
]
|
|
@ -1,3 +1,8 @@
|
|||
from django.shortcuts import render
|
||||
|
||||
# Create your views here.
|
||||
from .models import Process
|
||||
|
||||
|
||||
def process_details(request, pk):
|
||||
process = Process.objects.prefetch_related('tasks').select_related('document_version').get(pk=pk)
|
||||
return render(request, 'process/process_details.html', {'process': process})
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
{% extends "../base.html" %}
|
||||
|
||||
{% block "navigation" %}
|
||||
<ul>
|
||||
{% for version in document.versions.all %}
|
||||
<li>{{ version }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock "navigation" %}
|
||||
|
||||
{% block "content" %}
|
||||
|
||||
<h2>{{ document.title }}</h2>
|
||||
<p>Document Type: {{ document.type }} - Created at {{ document.created_at }}</p>
|
||||
<p>Overview: {{ document.overview }}</p>
|
||||
|
||||
{% if document.last_published_version %}
|
||||
<h3>Last published version: {{ document.last_published_version }}</h3>
|
||||
<ul>
|
||||
<li>Authors: {% for author in document.last_published_version.authors.all %}{{ author }}{% endfor %}</li>
|
||||
<li>Keywords: {% for keyword in document.last_published_version.keywords.all %}{{ keyword }}{% endfor %}</li>
|
||||
<li>Audiences: {% for audience in document.last_published_version.audiences.all %}{{ audience }}{% endfor %}</li>
|
||||
<li>Nodes: {% for node in document.last_published_version.nodes.all %}{{ node }}{% endfor %}</li>
|
||||
<li>Sites: {% for site in document.last_published_version.sites.all %}{{ site }}{% endfor %}</li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% if document.last_working_version %}
|
||||
<h3>Last working version: {{ document.last_working_version }}</h3>
|
||||
<h4>Properties</h4>
|
||||
<ul>
|
||||
<li>Authors: {% for author in document.last_working_version.authors.all %}{{ author }}{% endfor %}</li>
|
||||
<li>Keywords: {% for keyword in document.last_working_version.keywords.all %}{{ keyword }}{% endfor %}</li>
|
||||
<li>Audiences: {% for audience in document.last_working_version.audiences.all %}{{ audience }}{% endfor %}</li>
|
||||
<li>Nodes: {% for node in document.last_working_version.nodes.all %}{{ node }}{% endfor %}</li>
|
||||
<li>Sites: {% for site in document.last_working_version.sites.all %}{{ site }}{% endfor %}</li>
|
||||
</ul>
|
||||
<h4>Processes</h4>
|
||||
<ul>
|
||||
{% for process in document.last_working_version.processes.all %}
|
||||
<li>{{ process }} - {{ process.percentage_of_completion }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endblock "content" %}
|
|
@ -0,0 +1,15 @@
|
|||
{% extends "../base.html" %}
|
||||
|
||||
{% block "navigation" %}
|
||||
<form action="" method="get">
|
||||
{{ filter.form.as_p }}
|
||||
<input type="submit" />
|
||||
</form>
|
||||
{% endblock %}
|
||||
{% block "content" %}
|
||||
<ul>
|
||||
{% for obj in filter.qs %}
|
||||
<li><a href="{% url 'document_details' obj.document.id %}">{{ obj.document }} {{ obj }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock %}
|
|
@ -1,20 +0,0 @@
|
|||
{% extends "../base.html" %}
|
||||
|
||||
{% block "navigation" %}
|
||||
<form action="" method="get">
|
||||
{{ filter.form.as_p }}
|
||||
<input type="submit" />
|
||||
</form>
|
||||
{% endblock %}
|
||||
{% block "content" %}
|
||||
<ul>
|
||||
{% for obj in filter.qs %}
|
||||
<li>{{ obj }}
|
||||
<ul>
|
||||
<li>Dernière copie publiée: {{ obj.last_published_version }}</li>
|
||||
<li>Dernière copie en cours de travail: {{ obj.last_working_version }}</li>
|
||||
</ul>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock %}
|
|
@ -0,0 +1,9 @@
|
|||
{% extends "../base.html" %}
|
||||
|
||||
{% block "navigation" %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block "content" %}
|
||||
|
||||
{% endblock %}
|
|
@ -0,0 +1,13 @@
|
|||
{% extends "../base.html" %}
|
||||
|
||||
{% block "content" %}
|
||||
|
||||
<h2>Process details</h2>
|
||||
<p>{{ process.created_at }}</p>
|
||||
<p>{{ process.percentage_of_completion }}%</p>
|
||||
<ul>
|
||||
{% for task in process.tasks.all %}
|
||||
<li>{{ task }} - {{ task.get_status_display }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock "content" %}
|
Loading…
Reference in New Issue