Changeset - 6fb680931627
[Not reviewed]
0 4 0
Joel Addison - 5 years ago 2019-10-13 12:22:15
joel@addison.net.au
Improve registration report formatting

Show title in list instead of method name.
Add page title and head title to reports.
4 files changed with 11 insertions and 3 deletions:
0 comments (0 inline, 0 general)
pinaxcon/templates/registrasion/report.html
Show inline comments
 
{% extends "site_base.html" %}
 
{% load bootstrap %}
 
{% load registrasion_tags %}
 

	
 
{% block page_title %}Registration report{% endblock %}
 
{% block head_title %}Registration report - {{ title }}{% endblock %}
 

	
 
{% block content %}
 

	
 
  <h2>{{ title }}</h2>
 

	
 
  <p><a href="{% url 'reports_list' %}">Return to reports list</a></p>
 

	
pinaxcon/templates/registrasion/reports_list.html
Show inline comments
 
{% extends "site_base.html" %}
 
{% load registrasion_tags %}
 
{% block content %}
 

	
 
<h2>Registration reports</h2>
 
{% block page_title %}Registration reports{% endblock %}
 
{% block head_title %}Registration reports{% endblock %}
 

	
 
{% block content %}
 
<table class="table table-striped">
 
  {% for report in reports %}
 
    <tr>
 
      <td>
 
        <a href="{{ report.url }}">{{ report.name }}</a>
 
        <a href="{{ report.url }}">{{ report.title }}</a>
 
      </td>
 
      <td>
 
        {{ report.description }}
 
      </td>
 
    </tr>
 
  {% endfor %}
vendor/registrasion/registrasion/reporting/reports.py
Show inline comments
...
 
@@ -75,12 +75,13 @@ class _ReportTemplateWrapper(object):
 
    def rows(self):
 
        return self.report.rows(self.content_type)
 

	
 
    def count(self):
 
        return self.report.count()
 

	
 

	
 
class BasicReport(Report):
 

	
 
    def __init__(self, title, headings, link_view=None):
 
        super(BasicReport, self).__init__()
 
        self._title = title
 
        self._headings = headings
...
 
@@ -163,12 +164,13 @@ class QuerysetReport(BasicReport):
 
            ]
 

	
 

	
 
    def count(self):
 
        return self._queryset.count()
 

	
 

	
 
class Links(Report):
 

	
 
    def __init__(self, title, links):
 
        '''
 
        Arguments:
 
            links ([tuple, ...]): a list of 2-tuples:
...
 
@@ -190,12 +192,13 @@ class Links(Report):
 
                self._linked_text(content_type, url, link_text)
 
            ]
 

	
 
    def count(self):
 
        return len(self._links)
 

	
 

	
 
def report_view(title, form_type=None):
 
    ''' Decorator that converts a report view function into something that
 
    displays a Report.
 

	
 
    Arguments:
 
        title (str):
vendor/registrasion/registrasion/reporting/views.py
Show inline comments
...
 
@@ -48,12 +48,13 @@ def reports_list(request):
 

	
 
    reports = []
 

	
 
    for report in get_all_reports():
 
        reports.append({
 
            "name": report.__name__,
 
            "title": report.title,
 
            "url": reverse(report),
 
            "description": report.__doc__,
 
        })
 

	
 
    reports.sort(key=lambda report: report["name"])
 

	
0 comments (0 inline, 0 general)