summaryrefslogtreecommitdiff
path: root/ishtar_common/views.py
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2022-11-14 18:58:48 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2022-12-12 12:23:19 +0100
commit58663c87b11bfe0b60a9861a8fddd5bbb22ca0b4 (patch)
tree1b823f5e78e7214f84da3892e0729c0c2706ad6d /ishtar_common/views.py
parentefa5688099bbddbe7dc28efe6129070988441c8d (diff)
downloadIshtar-58663c87b11bfe0b60a9861a8fddd5bbb22ca0b4.tar.bz2
Ishtar-58663c87b11bfe0b60a9861a8fddd5bbb22ca0b4.zip
Remove dead code about dashboards
Diffstat (limited to 'ishtar_common/views.py')
-rw-r--r--ishtar_common/views.py120
1 files changed, 0 insertions, 120 deletions
diff --git a/ishtar_common/views.py b/ishtar_common/views.py
index 4cdbcf8c9..9e4177f45 100644
--- a/ishtar_common/views.py
+++ b/ishtar_common/views.py
@@ -55,14 +55,8 @@ from markdown import markdown
from . import models
from archaeological_context_records.models import ContextRecord
-from archaeological_files.forms import DashboardForm as DashboardFormFile
from archaeological_files.models import File
-from archaeological_finds.forms import (
- DashboardTreatmentForm,
- DashboardTreatmentFileForm,
-)
from archaeological_finds.models import Find, Treatment, TreatmentFile
-from archaeological_operations.forms import DashboardForm as DashboardFormOpe
from archaeological_operations.models import Operation, ArchaeologicalSite
from archaeological_warehouse.models import Warehouse
from ishtar_common import forms_common as forms
@@ -991,120 +985,6 @@ def action(request, action_slug, obj_id=None, *args, **kwargs):
return render(request, "index.html", dct)
-def dashboard_main(request, dct, obj_id=None, *args, **kwargs):
- """
- Main dashboard
- """
- app_list = []
- profile = models.get_current_profile()
- if profile.files:
- app_list.append((_("Archaeological files"), "files"))
- app_list.append((_("Operations"), "operations"))
- if profile.context_record:
- app_list.append((_("Context records"), "contextrecords"))
- if profile.find:
- app_list.append((_("Finds"), "finds"))
- if profile.warehouse:
- app_list.append((_("Treatment requests"), "treatmentfiles"))
- app_list.append((_("Treatments"), "treatments"))
- dct = {"app_list": app_list}
- return render(request, "ishtar/dashboards/dashboard_main.html", dct)
-
-
-DASHBOARD_FORMS = {
- "files": DashboardFormFile,
- "operations": DashboardFormOpe,
- "treatments": DashboardTreatmentForm,
- "treatmentfiles": DashboardTreatmentFileForm,
-}
-
-
-def dashboard_main_detail(request, item_name):
- """
- Specific tab of the main dashboard
- """
- if item_name == "users":
- dct = {"ishtar_users": models.UserDashboard()}
- return render(
- request, "ishtar/dashboards/dashboard_main_detail_users.html", dct
- )
- form = None
- slicing, date_source, fltr, show_detail = "year", None, {}, False
- profile = models.get_current_profile()
- has_form = (
- (item_name == "files" and profile.files)
- or item_name == "operations"
- or (item_name in ("treatmentfiles", "treatments") and profile.warehouse)
- )
- if has_form:
- slicing = "month"
- if item_name in DASHBOARD_FORMS:
- if request.method == "POST":
- form = DASHBOARD_FORMS[item_name](request.POST)
- if form.is_valid():
- slicing = form.cleaned_data["slicing"]
- fltr = form.get_filter()
- if hasattr(form, "get_date_source"):
- date_source = form.get_date_source()
- if hasattr(form, "get_show_detail"):
- show_detail = form.get_show_detail()
- else:
- form = DASHBOARD_FORMS[item_name]()
- lbl, dashboard = None, None
- dashboard_kwargs = {}
- if has_form:
- dashboard_kwargs = {"slice": slicing, "fltr": fltr, "show_detail": show_detail}
- # date_source is only relevant when the form has set one
- if date_source:
- dashboard_kwargs["date_source"] = date_source
- if item_name == "files" and profile.files:
- lbl, dashboard = (
- _("Archaeological files"),
- models.Dashboard(File, **dashboard_kwargs),
- )
- elif item_name == "operations":
- from archaeological_operations.models import Operation
-
- lbl, dashboard = (
- _("Operations"),
- models.Dashboard(Operation, **dashboard_kwargs),
- )
- elif item_name == "contextrecords" and profile.context_record:
- lbl, dashboard = (
- _("Context records"),
- models.Dashboard(ContextRecord, slice=slicing, fltr=fltr),
- )
- elif item_name == "finds" and profile.find:
- lbl, dashboard = (_("Finds"), models.Dashboard(Find, slice=slicing, fltr=fltr))
- elif item_name == "treatmentfiles" and profile.warehouse:
- lbl, dashboard = (
- _("Treatment requests"),
- models.Dashboard(TreatmentFile, **dashboard_kwargs),
- )
- elif item_name == "treatments" and profile.warehouse:
- if "date_source" not in dashboard_kwargs:
- dashboard_kwargs["date_source"] = "start"
- lbl, dashboard = (
- _("Treatments"),
- models.Dashboard(Treatment, **dashboard_kwargs),
- )
- if not lbl:
- raise Http404
- dct = {
- "lbl": lbl,
- "dashboard": dashboard,
- "item_name": item_name.replace("-", "_"),
- "VALUE_QUOTE": "" if slicing == "year" else "'",
- "form": form,
- "slicing": slicing,
- }
- n = datetime.datetime.now()
- dct["unique_id"] = (
- dct["item_name"] + "_" + "%d_%d_%d" % (n.minute, n.second, n.microsecond)
- )
- return render(request, "ishtar/dashboards/dashboard_main_detail.html", dct)
-
-
def reset_wizards(request):
# dynamically execute each reset_wizards of each ishtar app
for app in settings.INSTALLED_APPS: