86_User_suggestions_and_feedback #106
@ -339,13 +339,13 @@ class NewEcoAccountForm(AbstractCompensationForm, CompensationResponsibleFormMix
|
||||
super().__init__(*args, **kwargs)
|
||||
self.form_title = _("New Eco-Account")
|
||||
|
||||
self.action_url = reverse("compensation:acc-new")
|
||||
self.cancel_redirect = reverse("compensation:acc-index")
|
||||
self.action_url = reverse("compensation:acc:new")
|
||||
self.cancel_redirect = reverse("compensation:acc:index")
|
||||
|
||||
tmp = EcoAccount()
|
||||
identifier = tmp.generate_new_identifier()
|
||||
self.initialize_form_field("identifier", identifier)
|
||||
self.fields["identifier"].widget.attrs["url"] = reverse_lazy("compensation:acc-new-id")
|
||||
self.fields["identifier"].widget.attrs["url"] = reverse_lazy("compensation:acc:new-id")
|
||||
self.fields["title"].widget.attrs["placeholder"] = _("Eco-Account XY; Location ABC")
|
||||
|
||||
def save(self, user: User, geom_form: SimpleGeomForm):
|
||||
@ -402,8 +402,8 @@ class EditEcoAccountForm(NewEcoAccountForm):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.form_title = _("Edit Eco-Account")
|
||||
|
||||
self.action_url = reverse("compensation:acc-edit", args=(self.instance.id,))
|
||||
self.cancel_redirect = reverse("compensation:acc-detail", args=(self.instance.id,))
|
||||
self.action_url = reverse("compensation:acc:edit", args=(self.instance.id,))
|
||||
self.cancel_redirect = reverse("compensation:acc:detail", args=(self.instance.id,))
|
||||
|
||||
# Initialize form data
|
||||
reg_date = self.instance.legal.registration_date
|
||||
|
@ -7,6 +7,8 @@ Created on: 16.11.21
|
||||
"""
|
||||
import shutil
|
||||
|
||||
from django.urls import reverse
|
||||
|
||||
from user.models import User
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.core.validators import MinValueValidator
|
||||
@ -203,6 +205,14 @@ class EcoAccount(AbstractCompensation, ShareableObjectMixin, RecordableObjectMix
|
||||
is_ready = is_recorded
|
||||
return is_ready
|
||||
|
||||
def get_share_link(self):
|
||||
""" Returns the share url for the object
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
return reverse("compensation:acc:share", args=(self.id, self.access_token))
|
||||
|
||||
|
||||
class EcoAccountDocument(AbstractDocument):
|
||||
"""
|
||||
|
@ -201,7 +201,7 @@ class EcoAccountTable(BaseTable, TableRenderMixin):
|
||||
|
||||
def __init__(self, request: HttpRequest, *args, **kwargs):
|
||||
self.title = _("Eco Accounts")
|
||||
self.add_new_url = reverse("compensation:acc-new")
|
||||
self.add_new_url = reverse("compensation:acc:new")
|
||||
qs = kwargs.get("queryset", None)
|
||||
self.filter = EcoAccountTableFilter(
|
||||
user=request.user,
|
||||
@ -224,7 +224,7 @@ class EcoAccountTable(BaseTable, TableRenderMixin):
|
||||
html = ""
|
||||
html += self.render_link(
|
||||
tooltip=_("Open {}").format(_("Eco-account")),
|
||||
href=reverse("compensation:acc-detail", args=(record.id,)),
|
||||
href=reverse("compensation:acc:detail", args=(record.id,)),
|
||||
txt=value,
|
||||
new_tab=False,
|
||||
)
|
||||
|
@ -11,7 +11,7 @@
|
||||
<div class="col-sm-6">
|
||||
<div class="d-flex justify-content-end">
|
||||
{% if is_default_member and has_access %}
|
||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:acc-new-action' obj.id %}" title="{% trans 'Add new action' %}">
|
||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:acc:new-action' obj.id %}" title="{% trans 'Add new action' %}">
|
||||
{% fa5_icon 'plus' %}
|
||||
{% fa5_icon 'seedling' %}
|
||||
</button>
|
||||
@ -58,7 +58,7 @@
|
||||
<td class="align-middle">{{ action.comment|default_if_none:"" }}</td>
|
||||
<td class="align-middle">
|
||||
{% if is_default_member and has_access %}
|
||||
<button data-form-url="{% url 'compensation:acc-action-remove' obj.id action.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove action' %}">
|
||||
<button data-form-url="{% url 'compensation:acc:action-remove' obj.id action.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove action' %}">
|
||||
{% fa5_icon 'trash' %}
|
||||
</button>
|
||||
{% endif %}
|
||||
|
@ -6,36 +6,36 @@
|
||||
LANIS
|
||||
</button>
|
||||
</a>
|
||||
<a href="{% url 'compensation:acc-report' obj.id %}" target="_blank" class="mr-2">
|
||||
<a href="{% url 'compensation:acc:report' obj.id %}" target="_blank" class="mr-2">
|
||||
<button class="btn btn-default" title="{% trans 'Public report' %}">
|
||||
{% fa5_icon 'file-alt' %}
|
||||
</button>
|
||||
</a>
|
||||
{% if has_access %}
|
||||
<button class="btn btn-default btn-modal mr-2" title="{% trans 'Share' %}" data-form-url="{% url 'compensation:share-create' obj.id %}">
|
||||
<button class="btn btn-default btn-modal mr-2" title="{% trans 'Share' %}" data-form-url="{% url 'compensation:acc:share-create' obj.id %}">
|
||||
{% fa5_icon 'share-alt' %}
|
||||
</button>
|
||||
{% if is_ets_member %}
|
||||
{% if obj.recorded %}
|
||||
<button class="btn btn-default btn-modal mr-2" title="{% trans 'Unrecord' %}" data-form-url="{% url 'compensation:acc-record' obj.id %}">
|
||||
<button class="btn btn-default btn-modal mr-2" title="{% trans 'Unrecord' %}" data-form-url="{% url 'compensation:acc:record' obj.id %}">
|
||||
{% fa5_icon 'bookmark' 'far' %}
|
||||
</button>
|
||||
{% else %}
|
||||
<button class="btn btn-default btn-modal mr-2" title="{% trans 'Record' %}" data-form-url="{% url 'compensation:acc-record' obj.id %}">
|
||||
<button class="btn btn-default btn-modal mr-2" title="{% trans 'Record' %}" data-form-url="{% url 'compensation:acc:record' obj.id %}">
|
||||
{% fa5_icon 'bookmark' %}
|
||||
</button>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if is_default_member %}
|
||||
<a href="{% url 'compensation:acc-edit' obj.id %}" class="mr-2">
|
||||
<a href="{% url 'compensation:acc:edit' obj.id %}" class="mr-2">
|
||||
<button class="btn btn-default" title="{% trans 'Edit' %}">
|
||||
{% fa5_icon 'edit' %}
|
||||
</button>
|
||||
</a>
|
||||
<button class="btn btn-default btn-modal mr-2" data-form-url="{% url 'compensation:acc-log' obj.id %}" title="{% trans 'Show log' %}">
|
||||
<button class="btn btn-default btn-modal mr-2" data-form-url="{% url 'compensation:acc:log' obj.id %}" title="{% trans 'Show log' %}">
|
||||
{% fa5_icon 'history' %}
|
||||
</button>
|
||||
<button class="btn btn-default btn-modal" data-form-url="{% url 'compensation:acc-remove' obj.id %}" title="{% trans 'Delete' %}">
|
||||
<button class="btn btn-default btn-modal" data-form-url="{% url 'compensation:acc:remove' obj.id %}" title="{% trans 'Delete' %}">
|
||||
{% fa5_icon 'trash' %}
|
||||
</button>
|
||||
{% endif %}
|
||||
|
@ -11,7 +11,7 @@
|
||||
<div class="col-sm-6">
|
||||
<div class="d-flex justify-content-end">
|
||||
{% if is_default_member and has_access %}
|
||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:acc-new-deadline' obj.id %}" title="{% trans 'Add new deadline' %}">
|
||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:acc:new-deadline' obj.id %}" title="{% trans 'Add new deadline' %}">
|
||||
{% fa5_icon 'plus' %}
|
||||
{% fa5_icon 'calendar-check' %}
|
||||
</button>
|
||||
@ -48,7 +48,7 @@
|
||||
<td class="align-middle">{{ deadline.comment }}</td>
|
||||
<td>
|
||||
{% if is_default_member and has_access %}
|
||||
<button data-form-url="{% url 'deadline-remove' deadline.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove deadline' %}">
|
||||
<button data-form-url="{% url 'compensation:acc:deadline-remove' obj.id deadline.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove deadline' %}">
|
||||
{% fa5_icon 'trash' %}
|
||||
</button>
|
||||
{% endif %}
|
||||
|
@ -11,7 +11,7 @@
|
||||
<div class="col-sm-6">
|
||||
<div class="d-flex justify-content-end">
|
||||
{% if is_default_member and has_access %}
|
||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:acc-new-deduction' obj.id %}" title="{% trans 'Add new deduction' %}">
|
||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:acc:new-deduction' obj.id %}" title="{% trans 'Add new deduction' %}">
|
||||
{% fa5_icon 'plus' %}
|
||||
{% fa5_icon 'tree' %}
|
||||
</button>
|
||||
@ -60,7 +60,7 @@
|
||||
<td class="align-middle">{{ deduction.created.timestamp|default_if_none:""|naturalday}}</td>
|
||||
<td>
|
||||
{% if is_default_member and has_access %}
|
||||
<button data-form-url="{% url 'compensation:acc-remove-deduction' deduction.account.id deduction.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove Deduction' %}">
|
||||
<button data-form-url="{% url 'compensation:acc:remove-deduction' deduction.account.id deduction.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove Deduction' %}">
|
||||
{% fa5_icon 'trash' %}
|
||||
</button>
|
||||
{% endif %}
|
||||
|
@ -11,7 +11,7 @@
|
||||
<div class="col-sm-6">
|
||||
<div class="d-flex justify-content-end">
|
||||
{% if is_default_member and has_access %}
|
||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:acc-new-doc' obj.id %}" title="{% trans 'Add new document' %}">
|
||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:acc:new-doc' obj.id %}" title="{% trans 'Add new document' %}">
|
||||
{% fa5_icon 'plus' %}
|
||||
{% fa5_icon 'file' %}
|
||||
</button>
|
||||
@ -39,14 +39,14 @@
|
||||
{% for doc in obj.documents.all %}
|
||||
<tr>
|
||||
<td class="align-middle">
|
||||
<a href="{% url 'compensation:acc-get-doc' doc.id %}">
|
||||
<a href="{% url 'compensation:acc:get-doc' doc.id %}">
|
||||
{{ doc.title }}
|
||||
</a>
|
||||
</td>
|
||||
<td class="align-middle">{{ doc.comment }}</td>
|
||||
<td>
|
||||
{% if is_default_member and has_access %}
|
||||
<button data-form-url="{% url 'compensation:acc-remove-doc' doc.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove document' %}">
|
||||
<button data-form-url="{% url 'compensation:acc:remove-doc' doc.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove document' %}">
|
||||
{% fa5_icon 'trash' %}
|
||||
</button>
|
||||
{% endif %}
|
||||
|
@ -11,7 +11,7 @@
|
||||
<div class="col-sm-6">
|
||||
<div class="d-flex justify-content-end">
|
||||
{% if is_default_member and has_access %}
|
||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:acc-new-state' obj.id %}" title="{% trans 'Add new state after' %}">
|
||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:acc:new-state' obj.id %}" title="{% trans 'Add new state after' %}">
|
||||
{% fa5_icon 'plus' %}
|
||||
{% fa5_icon 'layer-group' %}
|
||||
</button>
|
||||
@ -61,7 +61,7 @@
|
||||
<td class="align-middle">{{ state.surface|floatformat:2 }} m²</td>
|
||||
<td class="align-middle">
|
||||
{% if is_default_member and has_access %}
|
||||
<button data-form-url="{% url 'compensation:acc-state-remove' obj.id state.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove state' %}">
|
||||
<button data-form-url="{% url 'compensation:acc:state-remove' obj.id state.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove state' %}">
|
||||
{% fa5_icon 'trash' %}
|
||||
</button>
|
||||
{% endif %}
|
||||
|
@ -11,7 +11,7 @@
|
||||
<div class="col-sm-6">
|
||||
<div class="d-flex justify-content-end">
|
||||
{% if is_default_member and has_access %}
|
||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:acc-new-state' obj.id %}?before=true" title="{% trans 'Add new state before' %}">
|
||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:acc:new-state' obj.id %}?before=true" title="{% trans 'Add new state before' %}">
|
||||
{% fa5_icon 'plus' %}
|
||||
{% fa5_icon 'layer-group' %}
|
||||
</button>
|
||||
@ -61,7 +61,7 @@
|
||||
<td class="align-middle">{{ state.surface|floatformat:2 }} m²</td>
|
||||
<td class="align-middle">
|
||||
{% if is_default_member and has_access %}
|
||||
<button data-form-url="{% url 'compensation:acc-state-remove' obj.id state.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove state' %}">
|
||||
<button data-form-url="{% url 'compensation:acc:state-remove' obj.id state.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove state' %}">
|
||||
{% fa5_icon 'trash' %}
|
||||
</button>
|
||||
{% endif %}
|
||||
|
@ -102,6 +102,7 @@
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
<div id="related_data">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-6">
|
||||
{% include 'compensation/detail/eco_account/includes/states-before.html' %}
|
||||
@ -126,6 +127,7 @@
|
||||
{% include 'compensation/detail/eco_account/includes/deductions.html' %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% with 'btn-modal' as btn_class %}
|
||||
|
@ -245,20 +245,20 @@ class EcoAccountViewTestCase(CompensationViewTestCase):
|
||||
cls.eco_account.actions.set([action])
|
||||
|
||||
# Prepare urls
|
||||
cls.index_url = reverse("compensation:acc-index", args=())
|
||||
cls.new_url = reverse("compensation:acc-new", args=())
|
||||
cls.new_id_url = reverse("compensation:acc-new-id", args=())
|
||||
cls.detail_url = reverse("compensation:acc-detail", args=(cls.eco_account.id,))
|
||||
cls.log_url = reverse("compensation:acc-log", args=(cls.eco_account.id,))
|
||||
cls.edit_url = reverse("compensation:acc-edit", args=(cls.eco_account.id,))
|
||||
cls.remove_url = reverse("compensation:acc-remove", args=(cls.eco_account.id,))
|
||||
cls.report_url = reverse("compensation:acc-report", args=(cls.eco_account.id,))
|
||||
cls.state_new_url = reverse("compensation:acc-new-state", args=(cls.eco_account.id,))
|
||||
cls.action_new_url = reverse("compensation:acc-new-action", args=(cls.eco_account.id,))
|
||||
cls.deadline_new_url = reverse("compensation:acc-new-deadline", args=(cls.eco_account.id,))
|
||||
cls.new_doc_url = reverse("compensation:acc-new-doc", args=(cls.eco_account.id,))
|
||||
cls.state_remove_url = reverse("compensation:acc-state-remove", args=(cls.eco_account.id, cls.comp_state.id,))
|
||||
cls.action_remove_url = reverse("compensation:acc-action-remove", args=(cls.eco_account.id, cls.comp_action.id,))
|
||||
cls.index_url = reverse("compensation:acc:index", args=())
|
||||
cls.new_url = reverse("compensation:acc:new", args=())
|
||||
cls.new_id_url = reverse("compensation:acc:new-id", args=())
|
||||
cls.detail_url = reverse("compensation:acc:detail", args=(cls.eco_account.id,))
|
||||
cls.log_url = reverse("compensation:acc:log", args=(cls.eco_account.id,))
|
||||
cls.edit_url = reverse("compensation:acc:edit", args=(cls.eco_account.id,))
|
||||
cls.remove_url = reverse("compensation:acc:remove", args=(cls.eco_account.id,))
|
||||
cls.report_url = reverse("compensation:acc:report", args=(cls.eco_account.id,))
|
||||
cls.state_new_url = reverse("compensation:acc:new-state", args=(cls.eco_account.id,))
|
||||
cls.action_new_url = reverse("compensation:acc:new-action", args=(cls.eco_account.id,))
|
||||
cls.deadline_new_url = reverse("compensation:acc:new-deadline", args=(cls.eco_account.id,))
|
||||
cls.new_doc_url = reverse("compensation:acc:new-doc", args=(cls.eco_account.id,))
|
||||
cls.state_remove_url = reverse("compensation:acc:state-remove", args=(cls.eco_account.id, cls.comp_state.id,))
|
||||
cls.action_remove_url = reverse("compensation:acc:action-remove", args=(cls.eco_account.id, cls.comp_action.id,))
|
||||
|
||||
def test_logged_in_no_groups_shared(self):
|
||||
""" Check correct status code for all requests
|
||||
|
@ -258,7 +258,7 @@ class EcoAccountWorkflowTestCase(BaseWorkflowTestCase):
|
||||
self.intervention.share_with(self.superuser)
|
||||
|
||||
# Prepare data for deduction creation
|
||||
deduct_url = reverse("compensation:acc-new-deduction", args=(self.eco_account.id,))
|
||||
deduct_url = reverse("compensation:acc:new-deduction", args=(self.eco_account.id,))
|
||||
test_surface = 10.00
|
||||
post_data = {
|
||||
"surface": test_surface,
|
||||
|
@ -8,31 +8,33 @@ Created on: 24.08.21
|
||||
from django.urls import path
|
||||
from compensation.views.eco_account import *
|
||||
|
||||
app_name = "acc"
|
||||
urlpatterns = [
|
||||
path("", index_view, name="acc-index"),
|
||||
path('new/', new_view, name='acc-new'),
|
||||
path('new/id', new_id_view, name='acc-new-id'),
|
||||
path('<id>', detail_view, name='acc-detail'),
|
||||
path('<id>/log', log_view, name='acc-log'),
|
||||
path('<id>/record', record_view, name='acc-record'),
|
||||
path('<id>/report', report_view, name='acc-report'),
|
||||
path('<id>/edit', edit_view, name='acc-edit'),
|
||||
path('<id>/remove', remove_view, name='acc-remove'),
|
||||
path('<id>/state/new', state_new_view, name='acc-new-state'),
|
||||
path('<id>/action/new', action_new_view, name='acc-new-action'),
|
||||
path('<id>/state/<state_id>/remove', state_remove_view, name='acc-state-remove'),
|
||||
path('<id>/action/<action_id>/remove', action_remove_view, name='acc-action-remove'),
|
||||
path('<id>/deadline/new', deadline_new_view, name="acc-new-deadline"),
|
||||
path("", index_view, name="index"),
|
||||
path('new/', new_view, name='new'),
|
||||
path('new/id', new_id_view, name='new-id'),
|
||||
path('<id>', detail_view, name='detail'),
|
||||
path('<id>/log', log_view, name='log'),
|
||||
path('<id>/record', record_view, name='record'),
|
||||
path('<id>/report', report_view, name='report'),
|
||||
path('<id>/edit', edit_view, name='edit'),
|
||||
path('<id>/remove', remove_view, name='remove'),
|
||||
path('<id>/state/new', state_new_view, name='new-state'),
|
||||
path('<id>/action/new', action_new_view, name='new-action'),
|
||||
path('<id>/state/<state_id>/remove', state_remove_view, name='state-remove'),
|
||||
path('<id>/action/<action_id>/remove', action_remove_view, name='action-remove'),
|
||||
path('<id>/deadline/<deadline_id>/remove', deadline_remove_view, name='deadline-remove'),
|
||||
path('<id>/deadline/new', deadline_new_view, name="new-deadline"),
|
||||
path('<id>/share/<token>', share_view, name='share'),
|
||||
path('<id>/share', create_share_view, name='share-create'),
|
||||
|
||||
# Documents
|
||||
path('<id>/document/new/', new_document_view, name='acc-new-doc'),
|
||||
path('document/<doc_id>', get_document_view, name='acc-get-doc'),
|
||||
path('document/<doc_id>/remove/', remove_document_view, name='acc-remove-doc'),
|
||||
path('<id>/document/new/', new_document_view, name='new-doc'),
|
||||
path('document/<doc_id>', get_document_view, name='get-doc'),
|
||||
path('document/<doc_id>/remove/', remove_document_view, name='remove-doc'),
|
||||
|
||||
# Eco-account deductions
|
||||
path('<id>/remove/<deduction_id>', deduction_remove_view, name='acc-remove-deduction'),
|
||||
path('<id>/deduct/new', new_deduction_view, name='acc-new-deduction'),
|
||||
path('<id>/remove/<deduction_id>', deduction_remove_view, name='remove-deduction'),
|
||||
path('<id>/deduct/new', new_deduction_view, name='new-deduction'),
|
||||
|
||||
]
|
@ -8,7 +8,8 @@ Created on: 24.08.21
|
||||
from django.urls import path
|
||||
from compensation.views.payment import *
|
||||
|
||||
app_name = "pay"
|
||||
urlpatterns = [
|
||||
path('<intervention_id>/new', new_payment_view, name='pay-new'),
|
||||
path('<id>/remove', payment_remove_view, name='pay-remove'),
|
||||
path('<intervention_id>/new', new_payment_view, name='new'),
|
||||
path('<id>/remove', payment_remove_view, name='remove'),
|
||||
]
|
||||
|
@ -10,6 +10,6 @@ from django.urls import path, include
|
||||
app_name = "compensation"
|
||||
urlpatterns = [
|
||||
path("", include("compensation.urls.compensation")),
|
||||
path("acc/", include("compensation.urls.eco_account")),
|
||||
path("pay/", include("compensation.urls.payment")),
|
||||
path("acc/", include("compensation.urls.eco_account", namespace="acc")),
|
||||
path("pay/", include("compensation.urls.payment", namespace="pay")),
|
||||
]
|
@ -24,6 +24,7 @@ from konova.contexts import BaseContext
|
||||
from konova.decorators import any_group_check, default_group_required, conservation_office_group_required, \
|
||||
shared_access_required
|
||||
from konova.forms import RemoveModalForm, SimpleGeomForm, NewDocumentForm, RecordModalForm
|
||||
from konova.models import Deadline
|
||||
from konova.settings import DEFAULT_GROUP, ZB_GROUP, ETS_GROUP
|
||||
from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER
|
||||
from konova.utils.documents import get_document, remove_document
|
||||
@ -89,7 +90,7 @@ def new_view(request: HttpRequest):
|
||||
)
|
||||
)
|
||||
messages.success(request, _("Eco-Account {} added").format(acc.identifier))
|
||||
return redirect("compensation:acc-detail", id=acc.id)
|
||||
return redirect("compensation:acc:detail", id=acc.id)
|
||||
else:
|
||||
messages.error(request, FORM_INVALID, extra_tags="danger",)
|
||||
else:
|
||||
@ -147,7 +148,7 @@ def edit_view(request: HttpRequest, id: str):
|
||||
# The data form takes the geom form for processing, as well as the performing user
|
||||
acc = data_form.save(request.user, geom_form)
|
||||
messages.success(request, _("Eco-Account {} edited").format(acc.identifier))
|
||||
return redirect("compensation:acc-detail", id=acc.id)
|
||||
return redirect("compensation:acc:detail", id=acc.id)
|
||||
else:
|
||||
messages.error(request, FORM_INVALID, extra_tags="danger",)
|
||||
else:
|
||||
@ -254,13 +255,13 @@ def remove_view(request: HttpRequest, id: str):
|
||||
user = request.user
|
||||
if not in_group(user, ETS_GROUP):
|
||||
messages.info(request, CANCEL_ACC_RECORDED_OR_DEDUCTED)
|
||||
return redirect("compensation:acc-detail", id=id)
|
||||
return redirect("compensation:acc:detail", id=id)
|
||||
|
||||
form = RemoveModalForm(request.POST or None, instance=acc, request=request)
|
||||
return form.process_request(
|
||||
request=request,
|
||||
msg_success=_("Eco-account removed"),
|
||||
redirect_url=reverse("compensation:acc-index"),
|
||||
redirect_url=reverse("compensation:acc:index"),
|
||||
)
|
||||
|
||||
|
||||
@ -287,7 +288,8 @@ def deduction_remove_view(request: HttpRequest, id: str, deduction_id: str):
|
||||
form = RemoveModalForm(request.POST or None, instance=eco_deduction, request=request)
|
||||
return form.process_request(
|
||||
request=request,
|
||||
msg_success=_("Deduction removed")
|
||||
msg_success=_("Deduction removed"),
|
||||
redirect_url=reverse("compensation:acc:detail", args=(id,)) + "#related_data"
|
||||
)
|
||||
|
||||
|
||||
@ -357,7 +359,8 @@ def state_new_view(request: HttpRequest, id: str):
|
||||
form = NewStateModalForm(request.POST or None, instance=acc, request=request)
|
||||
return form.process_request(
|
||||
request,
|
||||
msg_success=_("State added")
|
||||
msg_success=_("State added"),
|
||||
redirect_url=reverse("compensation:acc:detail", args=(id,)) + "#related_data"
|
||||
)
|
||||
|
||||
|
||||
@ -378,7 +381,8 @@ def action_new_view(request: HttpRequest, id: str):
|
||||
form = NewActionModalForm(request.POST or None, instance=acc, request=request)
|
||||
return form.process_request(
|
||||
request,
|
||||
msg_success=_("Action added")
|
||||
msg_success=_("Action added"),
|
||||
redirect_url=reverse("compensation:acc:detail", args=(id,)) + "#related_data"
|
||||
)
|
||||
|
||||
|
||||
@ -400,7 +404,8 @@ def state_remove_view(request: HttpRequest, id: str, state_id: str):
|
||||
form = RemoveModalForm(request.POST or None, instance=state, request=request)
|
||||
return form.process_request(
|
||||
request,
|
||||
msg_success=_("State removed")
|
||||
msg_success=_("State removed"),
|
||||
redirect_url=reverse("compensation:acc:detail", args=(id,)) + "#related_data"
|
||||
)
|
||||
|
||||
|
||||
@ -422,7 +427,31 @@ def action_remove_view(request: HttpRequest, id: str, action_id: str):
|
||||
form = RemoveModalForm(request.POST or None, instance=action, request=request)
|
||||
return form.process_request(
|
||||
request,
|
||||
msg_success=_("Action removed")
|
||||
msg_success=_("Action removed"),
|
||||
redirect_url=reverse("compensation:acc:detail", args=(id,)) + "#related_data"
|
||||
)
|
||||
|
||||
|
||||
@login_required
|
||||
@default_group_required
|
||||
@shared_access_required(EcoAccount, "id")
|
||||
def deadline_remove_view(request: HttpRequest, id: str, deadline_id: str):
|
||||
""" Renders a form for removing deadlines from a compensation
|
||||
|
||||
Args:
|
||||
request (HttpRequest): The incoming request
|
||||
id (str): The compensation's id
|
||||
deadline_id (str): The deadline's id
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
deadline = get_object_or_404(Deadline, id=deadline_id)
|
||||
form = RemoveModalForm(request.POST or None, instance=deadline, request=request)
|
||||
return form.process_request(
|
||||
request,
|
||||
msg_success=_("Deadline removed"),
|
||||
redirect_url=reverse("compensation:acc:detail", args=(id,)) + "#related_data"
|
||||
)
|
||||
|
||||
|
||||
@ -443,7 +472,8 @@ def deadline_new_view(request: HttpRequest, id: str):
|
||||
form = NewDeadlineModalForm(request.POST or None, instance=acc, request=request)
|
||||
return form.process_request(
|
||||
request,
|
||||
msg_success=_("Deadline added")
|
||||
msg_success=_("Deadline added"),
|
||||
redirect_url=reverse("compensation:acc:detail", args=(id,)) + "#related_data"
|
||||
)
|
||||
|
||||
|
||||
@ -463,7 +493,8 @@ def new_document_view(request: HttpRequest, id: str):
|
||||
form = NewEcoAccountDocumentForm(request.POST or None, request.FILES or None, instance=acc, request=request)
|
||||
return form.process_request(
|
||||
request,
|
||||
msg_success=_("Document added")
|
||||
msg_success=_("Document added"),
|
||||
redirect_url=reverse("compensation:acc:detail", args=(id,)) + "#related_data",
|
||||
)
|
||||
|
||||
|
||||
@ -490,7 +521,7 @@ def get_document_view(request: HttpRequest, doc_id: str):
|
||||
request,
|
||||
DATA_UNSHARED
|
||||
)
|
||||
return redirect("compensation:acc-detail", id=instance.id)
|
||||
return redirect("compensation:acc:detail", id=instance.id)
|
||||
return get_document(doc)
|
||||
|
||||
|
||||
@ -534,7 +565,7 @@ def new_deduction_view(request: HttpRequest, id: str):
|
||||
return form.process_request(
|
||||
request,
|
||||
msg_success=_("Deduction added"),
|
||||
redirect_url=reverse("compensation:detail", args=(id,)) + "#related_data"
|
||||
redirect_url=reverse("compensation:acc:detail", args=(id,)) + "#related_data"
|
||||
)
|
||||
|
||||
|
||||
@ -633,7 +664,7 @@ def share_view(request: HttpRequest, id: str, token: str):
|
||||
_("{} has been shared with you").format(obj.identifier)
|
||||
)
|
||||
obj.share_with(user)
|
||||
return redirect("compensation:acc-detail", id=id)
|
||||
return redirect("compensation:acc:detail", id=id)
|
||||
else:
|
||||
messages.error(
|
||||
request,
|
||||
|
@ -11,6 +11,7 @@ from django.contrib import messages
|
||||
from django.db import models
|
||||
from django.db.models import QuerySet
|
||||
from django.http import HttpRequest
|
||||
from django.urls import reverse
|
||||
|
||||
from compensation.models import AbstractCompensation
|
||||
from ema.managers import EmaManager
|
||||
@ -119,6 +120,14 @@ class Ema(AbstractCompensation, ShareableObjectMixin, RecordableObjectMixin):
|
||||
is_ready = is_recorded
|
||||
return is_ready
|
||||
|
||||
def get_share_link(self):
|
||||
""" Returns the share url for the object
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
return reverse("ema:share", args=(self.id, self.access_token))
|
||||
|
||||
|
||||
class EmaDocument(AbstractDocument):
|
||||
"""
|
||||
|
@ -48,7 +48,7 @@
|
||||
<td class="align-middle">{{ deadline.comment }}</td>
|
||||
<td>
|
||||
{% if is_default_member and has_access %}
|
||||
<button data-form-url="{% url 'deadline-remove' deadline.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove deadline' %}">
|
||||
<button data-form-url="{% url 'ema:deadline-remove' obj.id deadline.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove deadline' %}">
|
||||
{% fa5_icon 'trash' %}
|
||||
</button>
|
||||
{% endif %}
|
||||
|
@ -95,7 +95,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
|
||||
<div id="related_data">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 col-md-12 col-lg-6">
|
||||
{% include 'ema/detail/includes/states-before.html' %}
|
||||
@ -117,6 +117,7 @@
|
||||
{% include 'ema/detail/includes/documents.html' %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% with 'btn-modal' as btn_class %}
|
||||
|
@ -23,12 +23,12 @@ urlpatterns = [
|
||||
path('<id>/action/new', action_new_view, name='new-action'),
|
||||
path('<id>/state/<state_id>/remove', state_remove_view, name='state-remove'),
|
||||
path('<id>/action/<action_id>/remove', action_remove_view, name='action-remove'),
|
||||
path('<id>/deadline/<deadline_id>/remove', deadline_remove_view, name='deadline-remove'),
|
||||
path('<id>/deadline/new', deadline_new_view, name="new-deadline"),
|
||||
path('<id>/share/<token>', share_view, name='share'),
|
||||
path('<id>/share', create_share_view, name='share-create'),
|
||||
|
||||
# Documents
|
||||
# Document remove route can be found in konova/urls.py
|
||||
path('<id>/document/new/', document_new_view, name='new-doc'),
|
||||
path('document/<doc_id>', get_document_view, name='get-doc'),
|
||||
path('document/<doc_id>/remove/', remove_document_view, name='remove-doc'),
|
||||
|
42
ema/views.py
42
ema/views.py
@ -15,6 +15,7 @@ from konova.contexts import BaseContext
|
||||
from konova.decorators import conservation_office_group_required, shared_access_required
|
||||
from ema.models import Ema, EmaDocument
|
||||
from konova.forms import RemoveModalForm, SimpleGeomForm, RecordModalForm
|
||||
from konova.models import Deadline
|
||||
from konova.settings import DEFAULT_GROUP, ZB_GROUP, ETS_GROUP
|
||||
from konova.sub_settings.context_settings import TAB_TITLE_IDENTIFIER
|
||||
from konova.utils.documents import get_document, remove_document
|
||||
@ -290,7 +291,8 @@ def state_new_view(request: HttpRequest, id: str):
|
||||
form = NewStateModalForm(request.POST or None, instance=ema, request=request)
|
||||
return form.process_request(
|
||||
request,
|
||||
msg_success=_("State added")
|
||||
msg_success=_("State added"),
|
||||
redirect_url=reverse("ema:detail", args=(id,)) + "#related_data"
|
||||
)
|
||||
|
||||
|
||||
@ -311,7 +313,8 @@ def action_new_view(request: HttpRequest, id: str):
|
||||
form = NewActionModalForm(request.POST or None, instance=ema, request=request)
|
||||
return form.process_request(
|
||||
request,
|
||||
msg_success=_("Action added")
|
||||
msg_success=_("Action added"),
|
||||
redirect_url=reverse("ema:detail", args=(id,)) + "#related_data"
|
||||
)
|
||||
|
||||
|
||||
@ -332,7 +335,8 @@ def deadline_new_view(request: HttpRequest, id: str):
|
||||
form = NewDeadlineModalForm(request.POST or None, instance=ema, request=request)
|
||||
return form.process_request(
|
||||
request,
|
||||
msg_success=_("Deadline added")
|
||||
msg_success=_("Deadline added"),
|
||||
redirect_url=reverse("ema:detail", args=(id,)) + "#related_data"
|
||||
)
|
||||
|
||||
|
||||
@ -352,7 +356,8 @@ def document_new_view(request: HttpRequest, id: str):
|
||||
form = NewEmaDocumentForm(request.POST or None, request.FILES or None, instance=ema, request=request)
|
||||
return form.process_request(
|
||||
request,
|
||||
msg_success=_("Document added")
|
||||
msg_success=_("Document added"),
|
||||
redirect_url=reverse("ema:detail", args=(id,)) + "#related_data"
|
||||
)
|
||||
|
||||
|
||||
@ -422,7 +427,8 @@ def state_remove_view(request: HttpRequest, id: str, state_id: str):
|
||||
form = RemoveModalForm(request.POST or None, instance=state, request=request)
|
||||
return form.process_request(
|
||||
request,
|
||||
msg_success=_("State removed")
|
||||
msg_success=_("State removed"),
|
||||
redirect_url=reverse("ema:detail", args=(id,)) + "#related_data"
|
||||
)
|
||||
|
||||
|
||||
@ -444,7 +450,8 @@ def action_remove_view(request: HttpRequest, id: str, action_id: str):
|
||||
form = RemoveModalForm(request.POST or None, instance=action, request=request)
|
||||
return form.process_request(
|
||||
request,
|
||||
msg_success=_("Action removed")
|
||||
msg_success=_("Action removed"),
|
||||
redirect_url=reverse("ema:detail", args=(id,)) + "#related_data"
|
||||
)
|
||||
|
||||
|
||||
@ -565,3 +572,26 @@ def create_share_view(request: HttpRequest, id: str):
|
||||
request,
|
||||
msg_success=_("Share settings updated")
|
||||
)
|
||||
|
||||
|
||||
@login_required
|
||||
@conservation_office_group_required
|
||||
@shared_access_required(Ema, "id")
|
||||
def deadline_remove_view(request: HttpRequest, id: str, deadline_id: str):
|
||||
""" Renders a form for removing deadlines from a compensation
|
||||
|
||||
Args:
|
||||
request (HttpRequest): The incoming request
|
||||
id (str): The compensation's id
|
||||
deadline_id (str): The deadline's id
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
deadline = get_object_or_404(Deadline, id=deadline_id)
|
||||
form = RemoveModalForm(request.POST or None, instance=deadline, request=request)
|
||||
return form.process_request(
|
||||
request,
|
||||
msg_success=_("Deadline removed"),
|
||||
redirect_url=reverse("ema:detail", args=(id,)) + "#related_data"
|
||||
)
|
@ -80,10 +80,8 @@ class ShareModalForm(BaseModalForm):
|
||||
|
||||
"""
|
||||
# Initialize share_link field
|
||||
url_name = f"{self.instance._meta.app_label}:share"
|
||||
self.share_link = self.request.build_absolute_uri(
|
||||
reverse(url_name, args=(self.instance.id, self.instance.access_token,))
|
||||
)
|
||||
share_link = self.instance.get_share_link()
|
||||
self.share_link = self.request.build_absolute_uri(share_link)
|
||||
self.initialize_form_field(
|
||||
"url",
|
||||
self.share_link
|
||||
|
@ -8,6 +8,7 @@ Created on: 15.11.21
|
||||
import shutil
|
||||
|
||||
from django.contrib import messages
|
||||
from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
|
||||
from user.models import User
|
||||
@ -299,6 +300,14 @@ class Intervention(BaseObject, ShareableObjectMixin, RecordableObjectMixin, Chec
|
||||
and is_free_of_revocations
|
||||
return is_ready
|
||||
|
||||
def get_share_link(self):
|
||||
""" Returns the share url for the object
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
return reverse("intervention:share", args=(self.id, self.access_token))
|
||||
|
||||
|
||||
class InterventionDocument(AbstractDocument):
|
||||
"""
|
||||
|
@ -11,7 +11,7 @@
|
||||
<div class="col-sm-6">
|
||||
<div class="d-flex justify-content-end">
|
||||
{% if is_default_member and has_access %}
|
||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'intervention:acc-new-deduction' obj.id %}" title="{% trans 'Add new deduction' %}">
|
||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'intervention:new-deduction' obj.id %}" title="{% trans 'Add new deduction' %}">
|
||||
{% fa5_icon 'plus' %}
|
||||
{% fa5_icon 'tree' %}
|
||||
</button>
|
||||
@ -44,7 +44,7 @@
|
||||
{% for deduction in obj.deductions.all %}
|
||||
<tr {% if deduction.account.deleted %}class="align-middle alert-danger" title="{% trans 'Eco-account deleted! Deduction invalid!' %}" {% elif not deduction.account.recorded %}class="align-middle alert-danger" title="{% trans 'Eco-account not recorded! Deduction invalid!' %}" {% endif %}>
|
||||
<td class="align-middle">
|
||||
<a href="{% url 'compensation:acc-detail' deduction.account.id %}">
|
||||
<a href="{% url 'compensation:acc:detail' deduction.account.id %}">
|
||||
{% if deduction.account.deleted or not deduction.account.recorded %}
|
||||
{% fa5_icon 'exclamation-triangle' %}
|
||||
{% endif %}
|
||||
@ -55,7 +55,7 @@
|
||||
<td class="align-middle">{{ deduction.created.timestamp|default_if_none:""|naturalday}}</td>
|
||||
<td>
|
||||
{% if is_default_member and has_access %}
|
||||
<button data-form-url="{% url 'compensation:acc-remove-deduction' deduction.account.id deduction.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove Deduction' %}">
|
||||
<button data-form-url="{% url 'compensation:acc:remove-deduction' deduction.account.id deduction.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove Deduction' %}">
|
||||
{% fa5_icon 'trash' %}
|
||||
</button>
|
||||
{% endif %}
|
||||
|
@ -11,7 +11,7 @@
|
||||
<div class="col-sm-6">
|
||||
<div class="d-flex justify-content-end">
|
||||
{% if is_default_member and has_access %}
|
||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:pay-new' obj.id %}" title="{% trans 'Add new payment' %}">
|
||||
<button class="btn btn-outline-default btn-modal" data-form-url="{% url 'compensation:pay:new' obj.id %}" title="{% trans 'Add new payment' %}">
|
||||
{% fa5_icon 'plus' %}
|
||||
{% fa5_icon 'money-bill-wave' %}
|
||||
</button>
|
||||
@ -50,7 +50,7 @@
|
||||
<td class="align-middle">{{ pay.comment }}</td>
|
||||
<td>
|
||||
{% if is_default_member and has_access %}
|
||||
<button data-form-url="{% url 'compensation:pay-remove' pay.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove payment' %}">
|
||||
<button data-form-url="{% url 'compensation:pay:remove' pay.id %}" class="btn btn-default btn-modal" title="{% trans 'Remove payment' %}">
|
||||
{% fa5_icon 'trash' %}
|
||||
</button>
|
||||
{% endif %}
|
||||
|
@ -62,7 +62,7 @@
|
||||
<th scope="row">{% trans 'Deductions of eco-accounts' %}</th>
|
||||
<td class="align-middle">
|
||||
{% for deduction in deductions %}
|
||||
<a href="{% url 'compensation:acc-report' deduction.account.id %}">
|
||||
<a href="{% url 'compensation:acc:report' deduction.account.id %}">
|
||||
{{deduction.account.identifier}} - {{deduction.account.title}}
|
||||
</a>
|
||||
<br>
|
||||
|
@ -210,7 +210,7 @@ class InterventionWorkflowTestCase(BaseWorkflowTestCase):
|
||||
# Attention: Despite the fact, this url refers to a compensation app route, we test it here for the interventions.
|
||||
# Reason: A payment is some kind of compensation for an intervention. Therefore it lives inside the compensation app.
|
||||
# BUT: Payments are added on the intervention detail page. Therefore it's part of a regular intervention workflow.
|
||||
new_payment_url = reverse("compensation:pay-new", args=(self.intervention.id,))
|
||||
new_payment_url = reverse("compensation:pay:new", args=(self.intervention.id,))
|
||||
|
||||
# Make sure there are no payments on the intervention, yet
|
||||
self.assertEqual(0, self.intervention.payments.count())
|
||||
@ -251,7 +251,7 @@ class InterventionWorkflowTestCase(BaseWorkflowTestCase):
|
||||
|
||||
"""
|
||||
# Create removing url for the payment
|
||||
remove_url = reverse("compensation:pay-remove", args=(payment.id,))
|
||||
remove_url = reverse("compensation:pay:remove", args=(payment.id,))
|
||||
post_data = {
|
||||
"confirm": True,
|
||||
}
|
||||
@ -390,7 +390,7 @@ class InterventionWorkflowTestCase(BaseWorkflowTestCase):
|
||||
|
||||
"""
|
||||
# Create the url for creating a new deduction
|
||||
new_url = reverse("compensation:acc-new-deduction", args=(self.eco_account.id,))
|
||||
new_url = reverse("compensation:acc:new-deduction", args=(self.eco_account.id,))
|
||||
|
||||
# Prepare the form data
|
||||
test_surface = 100.00
|
||||
@ -415,7 +415,7 @@ class InterventionWorkflowTestCase(BaseWorkflowTestCase):
|
||||
|
||||
"""
|
||||
# Prepare url for deleting of this deduction
|
||||
delete_url = reverse("compensation:acc-remove-deduction", args=(self.eco_account.id, deduction.id,))
|
||||
delete_url = reverse("compensation:acc:remove-deduction", args=(self.eco_account.id, deduction.id,))
|
||||
post_data = {
|
||||
"confirm": True
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ urlpatterns = [
|
||||
path('document/<doc_id>/remove/', remove_document_view, name='remove-doc'),
|
||||
|
||||
# Deductions
|
||||
path('<id>/deduction/new', new_deduction_view, name='acc-new-deduction'),
|
||||
path('<id>/deduction/new', new_deduction_view, name='new-deduction'),
|
||||
|
||||
# Revocation routes
|
||||
path('<id>/revocation/new', new_revocation_view, name='new-revocation'),
|
||||
|
@ -479,6 +479,15 @@ class ShareableObjectMixin(models.Model):
|
||||
"""
|
||||
return self.users.all()
|
||||
|
||||
@abstractmethod
|
||||
def get_share_url(self):
|
||||
""" Returns the share url for the object
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
raise NotImplementedError("Must be implemented in subclasses!")
|
||||
|
||||
|
||||
class GeoReferencedMixin(models.Model):
|
||||
geometry = models.ForeignKey("konova.Geometry", null=True, blank=True, on_delete=models.SET_NULL)
|
||||
|
@ -4,7 +4,7 @@
|
||||
{% trans 'Eco-account' %}
|
||||
</h4>
|
||||
<div class="row">
|
||||
<a class="text-decoration-none" href="{% url 'compensation:acc-index' %}">
|
||||
<a class="text-decoration-none" href="{% url 'compensation:acc:index' %}">
|
||||
<div class="col-sm-5">
|
||||
<div class="qs-box d-flex justify-content-center align-items-center">
|
||||
{% fa5_icon 'tree' %}
|
||||
@ -26,12 +26,12 @@
|
||||
<div class="col-sm-12 col-lg">
|
||||
<div class="col-sm">
|
||||
<div class="row my-1">
|
||||
<a href="{% url 'compensation:acc-new' %}">
|
||||
<a href="{% url 'compensation:acc:new' %}">
|
||||
<button class="btn btn-default">{% fa5_icon 'plus' %} {% trans 'Create' %}</button>
|
||||
</a>
|
||||
</div>
|
||||
<div class="row my-1">
|
||||
<a href="{% url 'compensation:acc-index' %}">
|
||||
<a href="{% url 'compensation:acc:index' %}">
|
||||
<button class="btn btn-default">{% fa5_icon 'eye' %} {% trans 'Show' %}</button>
|
||||
</a>
|
||||
</div>
|
||||
|
@ -23,7 +23,7 @@ from konova.autocompletes import EcoAccountAutocomplete, \
|
||||
ShareUserAutocomplete, BiotopeExtraCodeAutocomplete, CompensationActionDetailCodeAutocomplete
|
||||
from konova.settings import SSO_SERVER, SSO_PUBLIC_KEY, SSO_PRIVATE_KEY, DEBUG
|
||||
from konova.sso.sso import KonovaSSOClient
|
||||
from konova.views import logout_view, home_view, remove_deadline_view
|
||||
from konova.views import logout_view, home_view
|
||||
|
||||
sso_client = KonovaSSOClient(SSO_SERVER, SSO_PUBLIC_KEY, SSO_PRIVATE_KEY)
|
||||
urlpatterns = [
|
||||
@ -40,9 +40,6 @@ urlpatterns = [
|
||||
path('analysis/', include("analysis.urls")),
|
||||
path('api/', include("api.urls")),
|
||||
|
||||
# Generic deadline routes
|
||||
path('deadline/<id>/remove', remove_deadline_view, name="deadline-remove"),
|
||||
|
||||
# Autocomplete paths for all apps
|
||||
path("atcmplt/eco-accounts", EcoAccountAutocomplete.as_view(), name="accounts-autocomplete"),
|
||||
path("atcmplt/interventions", InterventionAutocomplete.as_view(), name="interventions-autocomplete"),
|
||||
|
@ -99,25 +99,6 @@ def home_view(request: HttpRequest):
|
||||
return render(request, template, context)
|
||||
|
||||
|
||||
@login_required
|
||||
def remove_deadline_view(request: HttpRequest, id:str):
|
||||
""" Renders a modal form for removing a deadline object
|
||||
|
||||
Args:
|
||||
request (HttpRequest): The incoming request
|
||||
id (str): The deadline id
|
||||
|
||||
Returns:
|
||||
|
||||
"""
|
||||
deadline = get_object_or_404(Deadline, id=id)
|
||||
form = RemoveModalForm(request.POST or None, instance=deadline, request=request)
|
||||
return form.process_request(
|
||||
request,
|
||||
msg_success=_("Deadline removed")
|
||||
)
|
||||
|
||||
|
||||
def get_404_view(request: HttpRequest, exception=None):
|
||||
""" Returns a 404 handling view
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
</a>
|
||||
</li>
|
||||
<li class=" menu-elem">
|
||||
<a class="nav-btn nav-link" href="{% url 'compensation:acc-index' %}">
|
||||
<a class="nav-btn nav-link" href="{% url 'compensation:acc:index' %}">
|
||||
{% fa5_icon 'tree' %}
|
||||
{% trans 'Eco-account' %}
|
||||
</a>
|
||||
|
Loading…
Reference in New Issue
Block a user