From 4ccbb4bef309571159c9558cca5da04987a68646 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 22 Oct 2012 00:08:24 +0200 Subject: Djangoization - Major refactoring (step 15) * works on dashboards --- ishtar_common/menus.py | 30 +- ishtar_common/models.py | 1 + ishtar_common/templates/dashboard_file.html | 215 --------- ishtar_common/templates/dashboard_main.html | 82 ---- ishtar_common/templates/dashboard_operation.html | 510 --------------------- .../ishtar/dashboards/dashboard_main.html | 82 ++++ ishtar_common/urls.py | 6 +- ishtar_common/views.py | 23 +- 8 files changed, 109 insertions(+), 840 deletions(-) delete mode 100644 ishtar_common/templates/dashboard_file.html delete mode 100644 ishtar_common/templates/dashboard_main.html delete mode 100644 ishtar_common/templates/dashboard_operation.html create mode 100644 ishtar_common/templates/ishtar/dashboards/dashboard_main.html (limited to 'ishtar_common') diff --git a/ishtar_common/menus.py b/ishtar_common/menus.py index 4802a369d..77dcabcd3 100644 --- a/ishtar_common/menus.py +++ b/ishtar_common/menus.py @@ -37,7 +37,7 @@ for app in settings.INSTALLED_APPS: # sort __section_items = [menu for order, menu in sorted(_extra_menus, - key=lambda x:x[0])] + key=lambda x:x[0])] # regroup menus _section_items, __keys = [], [] for section_item in __section_items: @@ -45,29 +45,11 @@ for section_item in __section_items: __keys.append(section_item.idx) _section_items.append(section_item) continue - _section_items[__keys.index(section_item.idx)].childs += section_item.childs -""" - SectionItem('dashboard', _(u"Dashboard"), - childs=[ - MenuItem('dashboard_main', _(u"General informations"), - model=models.File, - access_controls=['change_file', 'change_own_file']), - MenuItem('dashboard_file', _(u"Archaeological files"), - model=models.File, - access_controls=['change_file', 'change_own_file']), - MenuItem('dashboard_operation', _(u"Operations"), - model=models.Operation, - access_controls=['change_operation', - 'change_own_operation']), - #MenuItem('dashboard_treatment', _(u"Treatments"), - # model=models.Treatment, - # access_controls=['change_treatment',]), - #MenuItem('dashboard_warehouse', _(u"Warehouses"), - # model=models.Warehouse, - # access_controls=['change_warehouse',]), - ]), - ] -""" + section_childs = _section_items[__keys.index(section_item.idx)].childs + childs_idx = [child.idx for child in section_childs] + for child in section_item.childs: + if child.idx not in childs_idx: + section_childs.append(child) class Menu: childs = _section_items diff --git a/ishtar_common/models.py b/ishtar_common/models.py index d8d3c3213..cff55ea5b 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -407,6 +407,7 @@ class Dashboard: last_ids = history_model.objects.values('id')\ .annotate(hd=Max('history_date')) last_ids = last_ids.filter(history_type=modif_type) + from archaeological_finds.models import Find if self.model == Find: last_ids = last_ids.filter(downstream_treatment_id__isnull=True) if modif_type == '+': diff --git a/ishtar_common/templates/dashboard_file.html b/ishtar_common/templates/dashboard_file.html deleted file mode 100644 index cebd147f4..000000000 --- a/ishtar_common/templates/dashboard_file.html +++ /dev/null @@ -1,215 +0,0 @@ -{% extends "base.html" %} -{% load i18n %} -{% load range %} -{% block extra_head %} -{{form.media}} -{% endblock %} -{% block content %} -
-

{% trans "Archaeological files" %}

-
-

{% trans "Global informations" %}

- -

{% trans "Total:" %} {{dashboard.total_number}}

- {% for type in dashboard.types %} -

{{type.file_type__label}}{% trans ":"%} {{type.number}}

- {% endfor %} -
- - - - {% for year in dashboard.by_year %}{% endfor %} - - - {% for year in dashboard.by_year %}{% endfor%} - -
{% trans "By year"%}
{{year.date.year}}
{{year.number}}
-
- -
- - - - {% for month in dashboard.by_month %}{% endfor %} - - - {% for month in dashboard.by_month %}{% endfor%} - -
{% trans "By month"%}
{{month.date|date:"F Y"|capfirst}}
{{month.number}}
-
- -
-
- -

{% trans "Research archaeology" %}

- -

{% trans "Total:" %} {{dashboard.research.total_number}}

-
- - - - {% for year in dashboard.research.by_year %}{% endfor %} - - - {% for year in dashboard.research.by_year %}{% endfor%} - -
{% trans "By year"%}
{{year.date.year}}
{{year.number}}
-
- -
- - - - {% for month in dashboard.research.by_month %}{% endfor %} - - - {% for month in dashboard.research.by_month %}{% endfor%} - -
{% trans "By month"%}
{{month.date|date:"F Y"|capfirst}}
{{month.number}}
-
- -
- - - - {% for dpt in dashboard.research.by_dpt %}{% endfor %} - - - {% for dpt in dashboard.research.by_dpt %}{% endfor%} - -
{% trans "By department"%}
{{dpt.department__label}}
{{dpt.number}}
-
- -
- - - - {% for town in dashboard.research.towns %}{% endfor %} - - - {% for town in dashboard.research.towns %}{% endfor%} - -
{% trans "Main towns"%}
{{town.town__name}}
{{town.number}}
-
- -
-
- -

{% trans "Rescue archaeology" %}

- -

{% trans "Total:" %} {{dashboard.rescue.total_number}}

- -
- - - - {% for saisine in dashboard.rescue.saisine %}{% endfor %} - - - {% for saisine in dashboard.rescue.saisine %}{% endfor%} - -
{% trans "By saisine type"%}
{{saisine.saisine_type__label}}
{{saisine.number}}
-
- -
- - - - {% for act in dashboard.rescue.administrative_act %}{% endfor %} - - - {% for act in dashboard.rescue.administrative_act %}{% endfor%} - -
{% trans "By administrative act"%}
{{act.act_type__label}}
{{act.number}}
-
- -
- - - - {% for year in dashboard.rescue.by_year %}{% endfor %} - - - {% for year in dashboard.rescue.by_year %}{% endfor%} - -
{% trans "By year"%}
{{year.date.year}}
{{year.number}}
-
- -
- - - - {% for month in dashboard.rescue.by_month %}{% endfor %} - - - {% for month in dashboard.rescue.by_month %}{% endfor%} - -
{% trans "By month"%}
{{month.date|date:"F Y"|capfirst}}
{{month.number}}
-
- -

{% trans "Archaeological files linked to at least one operation:" %} {{dashboard.rescue.with_associated_operation}}

-

{% trans "Archaeological files linked to at least one operation (%):" %} {{dashboard.rescue.with_associated_operation_percent}}

- -
- - - - {% for year in dashboard.rescue.operational_by_year %}{% endfor %} - - - {% for year in dashboard.rescue.operational_by_year %}{% endfor%} - -
{% trans "Archaeological files linked to at least one operation (%)"%}
{{year.date.year}}
{{year.number}}
-
- -
- - - - {% for dpt in dashboard.rescue.by_dpt %}{% endfor %} - - - {% for dpt in dashboard.rescue.by_dpt %}{% endfor%} - -
{% trans "By department"%}
{{dpt.department__label}}
{{dpt.number}}
-
- -
- - - - {% for dpt in dashboard.rescue.surface_by_dpt %}{% endfor %} - - - {% for dpt in dashboard.rescue.surface_by_dpt %}{% endfor%} - -
{% trans "Surface by department (m²)"%}
{{dpt.department__label}}
{{dpt.number}}
-
- -
- - - - {% for town in dashboard.rescue.towns %}{% endfor %} - - - {% for town in dashboard.rescue.towns %}{% endfor%} - -
{% trans "Main towns by number"%}
{{town.town__name}}
{{town.number}}
-
- -
- - - - {% for town in dashboard.rescue.surface_by_town %}{% endfor %} - - - {% for town in dashboard.rescue.surface_by_town %}{% endfor%} - -
{% trans "Main towns by surface (m²)"%}
{{town.town__name}}
{{town.number}}
-
- -
-
-{% endblock %} diff --git a/ishtar_common/templates/dashboard_main.html b/ishtar_common/templates/dashboard_main.html deleted file mode 100644 index e710dbe16..000000000 --- a/ishtar_common/templates/dashboard_main.html +++ /dev/null @@ -1,82 +0,0 @@ -{% extends "base.html" %} -{% load i18n %} -{% load range %} -{% block extra_head %} -{{form.media}} -{% endblock %} -{% block content %} -
-{% for lbl, dashboard in items %} -
-

{{lbl}}

-

{% trans "Numbers" %}

-

{% trans "Total:" %} {{dashboard.total_number}}

-
- - {% for idx, lbl, values in dashboard.values %} - - - {% for value in values %}{% endfor%} - - {% endfor%} -
{{lbl}}{{value}}
-
- {% if dashboard.years %} -

{% trans "By years" %}

-
    -
  • {% trans "Average:" %} {{dashboard.average}}
  • -
  • {% trans "Variance:" %} {{dashboard.variance}}
  • -
  • {% trans "Standard deviation:" %} {{dashboard.standard_deviation}}
  • -
  • {% trans "Median:" %} {{dashboard.median}}
  • -
  • {% trans "Mode:" %} {{dashboard.mode}}
  • -
- {% endif %} - {% if dashboard.operation_average %} -

{% trans "By operations" %}

-
    -
  • {% trans "Average:" %} {{dashboard.operation_average}}
  • -
  • {% trans "Variance:" %} {{dashboard.operation_variance}}
  • -
  • {% trans "Standard deviation:" %} {{dashboard.operation_standard_deviation}}
  • -
  • {% trans "Median:" %} {{dashboard.operation_median}}
  • -
  • {% trans "Mode:" %} {{dashboard.operation_mode}}
  • -
- {% endif %} -

{% trans "Created last" %}

-
- - - {% for item in dashboard.lasts %} - - - - {% endfor %} -
{{lbl}}{% trans "Created" %}
{{item}}{{item.history_date}}{% if item.get_show_url %}{%trans "Show"%}{%endif%}
-
-

{% trans "Recent changes" %}

-
- - - {% for item in dashboard.recents %} - - - - {% endfor %} -
{{lbl}}{% trans "Modified" %}
{{item}}{{item.history_date}}{% if item.get_show_url %}{%trans "Show"%}{%endif%}
-
-
-{% endfor%} -
-

{% trans "Users" %}

-
- - - {% for user_type in ishtar_users.types %} - - - - - {% endfor%} -
{% trans "User type" %}{% trans "Number" %}
{{user_type.person__person_type__label}}{{user_type.number}}
-
-
-{% endblock %} diff --git a/ishtar_common/templates/dashboard_operation.html b/ishtar_common/templates/dashboard_operation.html deleted file mode 100644 index 28f1dd9c6..000000000 --- a/ishtar_common/templates/dashboard_operation.html +++ /dev/null @@ -1,510 +0,0 @@ -{% extends "base.html" %} -{% load i18n %} -{% load range %} -{% block extra_head %} -{{form.media}} -{% endblock %} -{% block content %} -
-

{% trans "Operations" %}

-
-

{% trans "Global informations" %}

- -
- - - - - - {% for lbl, nb in dashboard.total %} - - - - {% endfor %} -
{% trans "Total" %}
{% trans "Status" %}{% trans "Number" %}
{{lbl}}{{nb}}
- -
- - - - - - {% for surface in dashboard.surface_by_type %} - - - - {% endfor %} -
{% trans "Area by type of operation" %}
{% trans "Status" %}{% trans "Area (m²)" %}
{{surface.operation_type__label}}{{surface.number}}
- -
- - - - {%for typ in dashboard.types %}{% endfor %} - - {% for lbl, types in dashboard.by_type %} - - {%for nb in types %}{% endfor %} - - {% endfor %} -
{% trans "By types" %}
{% trans "State" %}{{typ.label}}
{{lbl}}{{nb}}
- -
- - - - {%for yr in dashboard.years %}{% endfor %} - - {% for lbl, years in dashboard.by_year %} - - {%for nb in years %}{% endfor %} - - {% endfor %} -
{% trans "By year" %}
{% trans "State" %}{{yr}}
{{lbl}}{{nb}}
- -
- - - - {%for yr in dashboard.realisation_years %}{% endfor %} - - {% for lbl, years in dashboard.by_realisation_year %} - - {%for nb in years %}{% endfor %} - - {% endfor %} -
{% trans "By realisation year" %}
{% trans "State" %}{{yr.year}}
{{lbl}}{{nb}}
- -
- - - - {%for yr in dashboard.years %}{% endfor %} - - {% for lbl, years in dashboard.effective %} - - {%for nb in years %}{% endfor %} - - {% endfor %} -
{% trans "Effective operation by type and year" %}
{% trans "Type" %}{{yr}}
{{lbl}}{{nb}}
- -
- - - - {%for mt in dashboard.last_months %}{% endfor %} - - {% for lbl, months in dashboard.by_realisation_month %} - - {%for nb in months %}{% endfor %} - - {% endfor %} -
{% trans "By realisation month" %}
{% trans "State" %}{{mt.date|date:"F Y"|capfirst}}
{{lbl}}{{nb}}
- -
-
- -

{% trans "Survey informations" %}

- -
- - - - - - {% for lbl, nb in dashboard.survey.total %} - - - - {% endfor %} -
{% trans "Total" %}
{% trans "Status" %}{% trans "Number" %}
{{lbl}}{{nb}}
- -
- - - - {%for yr in dashboard.years %}{% endfor %} - - {% for lbl, years in dashboard.survey.by_year %} - - {%for nb in years %}{% endfor %} - - {% endfor %} -
{% trans "By year" %}
{% trans "State" %}{{yr}}
{{lbl}}{{nb}}
- -
- - - - {%for yr in dashboard.realisation_years %}{% endfor %} - - {% for lbl, years in dashboard.survey.by_realisation_year %} - - {%for nb in years %}{% endfor %} - - {% endfor %} -
{% trans "By realisation year" %}
{% trans "State" %}{{yr.year}}
{{lbl}}{{nb}}
- -
- - - - {% for lbl in dashboard.filters_label %}{%endfor%} - - - {% for nb in dashboard.survey.area %}{%endfor%} - - - {% for nb in dashboard.survey.manday %}{%endfor%} - - - {% for nb in dashboard.survey.mandayhect %}{%endfor%} - -
{% trans "Current year" %}
{% trans "Status" %}{{lbl}}
{% trans "Area"%}{{nb}}
{% trans "Man-day"%}{{nb}}
{% trans "Man-day/hectare"%}{{nb}}
- -

{% trans "Man-day/hectare for effective operations (current year):" %} {{dashboard.survey.mandayhect_effective}}

- -
- - - - - - {% for org in dashboard.survey.org %} - - - - {% endfor %} -
{% trans "Organizations (current year)" %}
 {% trans "Area" %}{% trans "Man-day" %}{% trans "Man-day/hectare" %}
{{org.in_charge__attached_to__name}}{{org.area}}{{org.manday}}{{org.mandayhect}}
- -
- - - - {% for lbl in dashboard.filters_label %}{%endfor%} - - - {% for nb in dashboard.survey.area_realised %}{%endfor%} - - - {% for nb in dashboard.survey.manday_realised %}{%endfor%} - - - {% for nb in dashboard.survey.mandayhect_realised %}{%endfor%} - -
{% trans "Current realisation year" %}
{% trans "Status" %}{{lbl}}
{% trans "Area"%}{{nb}}
{% trans "Man-day"%}{{nb}}
{% trans "Man-day/hectare"%}{{nb}}
- -

{% trans "Man-day/hectare for effective operations (current realisation year):" %} {{dashboard.survey.mandayhect_real_effective}}

- -
- - - - - - {% for org in dashboard.survey.org_realised %} - - - - {% endfor %} -
{% trans "Organizations (current realisation year)" %}
 {% trans "Area" %}{% trans "Man-day" %}{% trans "Man-day/hectare" %}
{{org.in_charge__attached_to__name}}{{org.area}}{{org.manday}}{{org.mandayhect}}
- -
- - - - {% for yr in dashboard.years%}{% endfor %} - - {% for org, vals in dashboard.survey.org_by_year %} - - {% for area, cost in vals %}{% endfor %} - - {% endfor %} - - {% for area in dashboard.survey.org_by_year_area_mean %}{% endfor %} - -
{% trans "Area by organization by year" %}
{% trans "Organization" %}{{yr}}
{{org}}{{area}}
{% trans "Mean" %}{{area}}
- -
- - - - {% for yr in dashboard.years%}{% endfor %} - - - {% for nb, mean in dashboard.survey.effective %}{% endfor %} - - - {% for nb, avg in dashboard.survey.effective %}{% endfor %} - -
{% trans "Effective operations areas (m²)" %}
 {{yr}}
{% trans "Sum" %}{{nb}}
{% trans "Average" %}{{avg}}
- -
- - - - {% for yr in dashboard.years%}{% endfor %} - - - {% for nb, mean in dashboard.survey.mandayshect %}{% endfor %} - - - {% for nb, avg in dashboard.survey.mandayshect %}{% endfor %} - -
{% trans "Man-Days/hectare by Year" %}
 {{yr}}
{% trans "Man-Days/hectare" %}{{nb}}
{% trans "Average" %}{{avg}}
- -
- - - - {%for mt in dashboard.last_months %}{% endfor %} - - {% for lbl, months in dashboard.survey.by_month %} - - {%for nb in months %}{% endfor %} - - {% endfor %} -
{% trans "By month" %}
{% trans "State" %}{{mt.date|date:"F Y"|capfirst}}
{{lbl}}{{nb}}
- -
- - - - {%for yr in dashboard.years %}{% endfor %} - - {% for lbl, years in dashboard.survey.by_dpt %} - - {%for nb in years %}{{nb}}{% endfor %} - - {% endfor %} -
{% trans "By department" %}
{% trans "Department" %}{{yr}}{% trans "Sum" %}
{{lbl}}
- -
- - - - {%for yr in dashboard.years %}{% endfor %} - - - {%for yr in dashboard.years %}{% endfor %} - - {% for lbl, years in dashboard.survey.effective_by_dpt %} - - {%for nb, area, cost, fnap in years %}{{nb}}{{area}}{% endfor %} - - {% endfor %} -
{% trans "Effective operation by department" %}
{% trans "Department" %}{{yr}}{% trans "Sum" %}
{%trans "Nb."%}{%trans "Area"%}{%trans "Nb."%}{%trans "Area"%}
{{lbl}}
- -
- - - - - - {% for lbl, nb in dashboard.survey.towns %} - - - - {% endfor %} -
{% trans "Main towns by number" %}
{% trans "Town" %}{% trans "Number" %}
{{lbl}}{{nb}}
- -
- - - - - - {% for lbl, nb in dashboard.survey.towns_surface %} - - - - {% endfor %} -
{% trans "Main towns by surface" %}
{% trans "Town" %}{% trans "Total surface (m²)" %}
{{lbl}}{{nb}}
- - -
-
- -

{% trans "Excavation informations" %}

- -
- - - - - - {% for lbl, nb in dashboard.excavation.total %} - - - - {% endfor %} -
{% trans "Total" %}
{% trans "Status" %}{% trans "Number" %}
{{lbl}}{{nb}}
- -
- - - - {%for yr in dashboard.years %}{% endfor %} - - {% for lbl, years in dashboard.excavation.by_year %} - - {%for nb in years %}{% endfor %} - - {% endfor %} -
{% trans "By year" %}
{% trans "State" %}{{yr}}
{{lbl}}{{nb}}
- -
- - - - {%for yr in dashboard.realisation_years %}{% endfor %} - - {% for lbl, years in dashboard.excavation.by_realisation_year %} - - {%for nb in years %}{% endfor %} - - {% endfor %} -
{% trans "By realisation year" %}
{% trans "State" %}{{yr.year}}
{{lbl}}{{nb}}
- -
- - - - {% for lbl in dashboard.filters_label %}{%endfor%} - - - {% for nb in dashboard.excavation.area_realised %}{%endfor%} - - - {% for nb in dashboard.excavation.manday_realised %}{%endfor%} - - - {% for nb in dashboard.excavation.mandayhect_realised %}{%endfor%} - -
{% trans "Current realisation year" %}
{% trans "Status" %}{{lbl}}
{% trans "Area"%}{{nb}}
{% trans "Man-day"%}{{nb}}
{% trans "Man-day/hectare"%}{{nb}}
- -

{% trans "Man-day/hectare for effective operations (current realisation year):" %} {{dashboard.excavation.mandayhect_real_effective}}

- -
- - - - - - {% for org in dashboard.excavation.org_realised %} - - - - {% endfor %} -
{% trans "Organizations (current realisation year)" %}
 {% trans "Area" %}{% trans "Man-day" %}{% trans "Man-day/hectare" %}
{{org.in_charge__attached_to__name}}{{org.area}}{{org.manday}}{{org.mandayhect}}
- -
- - - - {% for yr in dashboard.years%}{% endfor %} - - {% for org, vals in dashboard.excavation.org_by_year %} - - {% for area, cost in vals %}{% endfor %} - - {% endfor %} - - {% for area in dashboard.excavation.org_by_year_area_sum %}{% endfor %} - - - {% for area in dashboard.excavation.org_by_year_area_mean %}{% endfor %} - -
{% trans "Area by organization by year" %}
{% trans "Organization" %}{{yr}}
{{org}}{{area}}
{% trans "Sum" %}{{area}}
{% trans "Mean" %}{{area}}
- -
- - - - {% for yr in dashboard.years%}{% endfor %} - - {% for org, vals in dashboard.excavation.org_by_year %} - - {% for area, cost in vals %}{% endfor %} - - {% endfor %} - - {% for area in dashboard.excavation.org_by_year_area_sum %}{% endfor %} - - - {% for area in dashboard.excavation.org_by_year_area_mean %}{% endfor %} - -
{% trans "Area by organization by realisation year" %}
{% trans "Organization" %}{{yr}}
{{org}}{{area}}
{% trans "Sum" %}{{area}}
{% trans "Mean" %}{{area}}
- -
- - - - {%for mt in dashboard.last_months %}{% endfor %} - - {% for lbl, months in dashboard.excavation.by_month %} - - {%for nb in months %}{% endfor %} - - {% endfor %} -
{% trans "By month" %}
{% trans "State" %}{{mt.date|date:"F Y"|capfirst}}
{{lbl}}{{nb}}
- -
- - - - {%for yr in dashboard.years %}{% endfor %} - - {% for lbl, years in dashboard.excavation.by_dpt %} - - {%for nb in years %}{{nb}}{% endfor %} - - {% endfor %} -
{% trans "By department" %}
{% trans "Department" %}{{yr}}{% trans "Sum" %}
{{lbl}}
- -
- - - - {%for yr in dashboard.years %}{% endfor %} - - - {%for yr in dashboard.years %}{% endfor %} - - {% for lbl, years in dashboard.excavation.effective_by_dpt %} - - {%for nb, area, cost, fnap in years %}{{nb}}{{cost}}{{fnap}}{% endfor %} - - {% endfor %} -
{% trans "Effective operation by department" %}
{% trans "Department" %}{{yr}}{% trans "Sum" %}
{%trans "Nb."%}{%trans "Cost"%}{%trans "FNAP cost"%}{%trans "Nb."%}{%trans "Cost"%}{%trans "FNAP cost"%}
{{lbl}}
- -
- - - - - - {% for lbl, nb in dashboard.excavation.towns %} - - - - {% endfor %} -
{% trans "Main towns by number" %}
{% trans "Town" %}{% trans "Number" %}
{{lbl}}{{nb}}
- -
- - - - - - {% for lbl, nb in dashboard.excavation.towns_cost %} - - - - {% endfor %} -
{% trans "Main towns by cost" %}
{% trans "Town" %}{% trans "Cost (€)" %}
{{lbl}}{{nb}}
- - -
-
-{% endblock %} diff --git a/ishtar_common/templates/ishtar/dashboards/dashboard_main.html b/ishtar_common/templates/ishtar/dashboards/dashboard_main.html new file mode 100644 index 000000000..e710dbe16 --- /dev/null +++ b/ishtar_common/templates/ishtar/dashboards/dashboard_main.html @@ -0,0 +1,82 @@ +{% extends "base.html" %} +{% load i18n %} +{% load range %} +{% block extra_head %} +{{form.media}} +{% endblock %} +{% block content %} +
+{% for lbl, dashboard in items %} +
+

{{lbl}}

+

{% trans "Numbers" %}

+

{% trans "Total:" %} {{dashboard.total_number}}

+
+ + {% for idx, lbl, values in dashboard.values %} + + + {% for value in values %}{% endfor%} + + {% endfor%} +
{{lbl}}{{value}}
+
+ {% if dashboard.years %} +

{% trans "By years" %}

+
    +
  • {% trans "Average:" %} {{dashboard.average}}
  • +
  • {% trans "Variance:" %} {{dashboard.variance}}
  • +
  • {% trans "Standard deviation:" %} {{dashboard.standard_deviation}}
  • +
  • {% trans "Median:" %} {{dashboard.median}}
  • +
  • {% trans "Mode:" %} {{dashboard.mode}}
  • +
+ {% endif %} + {% if dashboard.operation_average %} +

{% trans "By operations" %}

+
    +
  • {% trans "Average:" %} {{dashboard.operation_average}}
  • +
  • {% trans "Variance:" %} {{dashboard.operation_variance}}
  • +
  • {% trans "Standard deviation:" %} {{dashboard.operation_standard_deviation}}
  • +
  • {% trans "Median:" %} {{dashboard.operation_median}}
  • +
  • {% trans "Mode:" %} {{dashboard.operation_mode}}
  • +
+ {% endif %} +

{% trans "Created last" %}

+
+ + + {% for item in dashboard.lasts %} + + + + {% endfor %} +
{{lbl}}{% trans "Created" %}
{{item}}{{item.history_date}}{% if item.get_show_url %}{%trans "Show"%}{%endif%}
+
+

{% trans "Recent changes" %}

+
+ + + {% for item in dashboard.recents %} + + + + {% endfor %} +
{{lbl}}{% trans "Modified" %}
{{item}}{{item.history_date}}{% if item.get_show_url %}{%trans "Show"%}{%endif%}
+
+
+{% endfor%} +
+

{% trans "Users" %}

+
+ + + {% for user_type in ishtar_users.types %} + + + + + {% endfor%} +
{% trans "User type" %}{% trans "Number" %}
{{user_type.person__person_type__label}}{{user_type.number}}
+
+
+{% endblock %} diff --git a/ishtar_common/urls.py b/ishtar_common/urls.py index cebea1dbe..597327379 100644 --- a/ishtar_common/urls.py +++ b/ishtar_common/urls.py @@ -48,8 +48,8 @@ actions = r"|".join(actions) # other views urlpatterns += patterns('ishtar_common.views', # General - url(r'(?P' + actions + r')/$', 'action', - name='action'), + url(r'dashboard-main/$', 'dashboard_main', + name='dashboard-main'), url(r'update-current-item/$', 'update_current_item', name='update-current-item'), url(r'new-person/(?P.+)?/$', @@ -66,4 +66,6 @@ urlpatterns += patterns('ishtar_common.views', 'new_organization', name='new-organization'), url(r'autocomplete-organization/([0-9_]+)?$', 'autocomplete_organization', name='autocomplete-organization'), + url(r'(?P' + actions + r')/$', 'action', + name='action'), ) diff --git a/ishtar_common/views.py b/ishtar_common/views.py index 6c682c932..d0a5af7b7 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -535,6 +535,7 @@ def action(request, action_slug, obj_id=None, *args, **kwargs): associated_wizard = action_slug + '_wizard' dct = {} globals_dct = globals() + print action_slug if action_slug in globals_dct: return globals_dct[action_slug](request, dct, obj_id, *args, **kwargs) elif hasattr(ishtar_forms, action_slug + "_wizard"): @@ -547,12 +548,20 @@ def dashboard_main(request, dct, obj_id=None, *args, **kwargs): """ Main dashboard """ - dct = {'items':[ - (_(u"Archaeological files"), models.Dashboard(models.File)), - (_(u"Operations"), models.Dashboard(models.Operation)), - (_(u"Context records"), models.Dashboard(models.ContextRecord)), - (_(u"Archaeological items"), models.Dashboard(models.Item)), - ], + items = [] + if 'archaeological_files' in settings.INSTALLED_APPS: + from archaeological_files.models import File + items.append((_(u"Archaeological files"), + models.Dashboard(File))) + from archaeological_operations.models import Operation + items.append((_(u"Operations"), models.Dashboard(Operation))) + if 'archaeological_context_records' in settings.INSTALLED_APPS: + from archaeological_context_records.models import ContextRecord + items.append((_(u"Context records"), models.Dashboard(ContextRecord))) + if 'archaeological_finds' in settings.INSTALLED_APPS: + from archaeological_finds.models import Find + items.append((_(u"Context records"), models.Dashboard(Find))) + dct = {'items':items, 'ishtar_users':models.UserDashboard()} - return render_to_response('dashboard_main.html', dct, + return render_to_response('ishtar/dashboards/dashboard_main.html', dct, context_instance=RequestContext(request)) -- cgit v1.2.3