Commit 62d3f65d authored by Marko Kuder's avatar Marko Kuder
Browse files

Merge branch 'drafts-report' into 'development'

Add report to view packeges in draft

See merge request !11
parents b66b2626 89381870
......@@ -24,7 +24,7 @@ def refresh_opsi_reports():
import time
registry = ReportRegistry.instance()
timings = {}
report_list = ['unpublished']
report_list = ['unpublished', 'draft']
for report_name in report_list:
s = time.time()
registry.get_report(report_name).refresh_cache_for_all_options()
......@@ -381,6 +381,43 @@ unpublished_report_info = {
'template': 'report/unpublished.html',
}
def draft():
pkgs = model.Session.query(model.Package)\
.filter(model.Package.state=='draft')\
.join(model.PackageExtra)\
.filter_by(key='unpublished')\
.filter_by(value='false')\
.all()
pkg_dicts = []
for pkg in pkgs:
org = pkg.get_organization()
podrocje = pkg.extras.get('podrocje', u'')
author = dgu_helpers.get_user_name(pkg.creator_user_id)
pkg_dict = {
'id': pkg.id,
'name': pkg.name,
'title': pkg.title,
'organization title': org.title if org else u"",
'organization name': org.name if org else u"",
'notes': pkg.notes,
'author': author,
'state': pkg.state,
'podrocje': podrocje
}
pkg_dicts.append(pkg_dict)
return {'table': pkg_dicts}
draft_report_info = {
'name': 'draft',
'title': u'Zbirke v osnutku',
'description': u'Seznam osnutkov, ki so jih avtorji poslali glavnim urednikom in čakajo na potrditev za objavo.',
'option_defaults': None,
'option_combinations': None,
'generate': draft,
'template': 'report/draft.html',
}
def last_resource_deleted(pkg):
resource_revisions = model.Session.query(model.ResourceRevision) \
......
......@@ -402,6 +402,7 @@ class PublisherPlugin(p.SingletonPlugin):
reports.publisher_activity_report_info,
reports.publisher_resources_info,
reports.unpublished_report_info,
reports.draft_report_info,
reports.datasets_without_resources_info,
#reports.app_dataset_theme_report_info,
#reports.app_dataset_report_info,
......
{% extends "report/unpublished.html" %}
{% block packages_count %}
<p>
Število zbirk v osnutku: {{data['table']|length }}
</p>
{% endblock %}
{% set podrocje_choices = h.podrocje_choices(data)%}
<div class="widget-container">
{% block packages_count %}
<p>
Število zbirk v potrjevanju: {{data['table']|length }}
</p>
{% endblock %}
<table class="table table-bordered table-condensed tablesorter" id="report-table" style="width: 100%;table-layout:fixed; margin-top: 8px;">
<thead>
<tr>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment