diff --git a/compensation/forms/forms.py b/compensation/forms/forms.py index 0970daad..7ac7f601 100644 --- a/compensation/forms/forms.py +++ b/compensation/forms/forms.py @@ -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 diff --git a/compensation/models/eco_account.py b/compensation/models/eco_account.py index afe556f9..8e4d32e1 100644 --- a/compensation/models/eco_account.py +++ b/compensation/models/eco_account.py @@ -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): """ diff --git a/compensation/tables.py b/compensation/tables.py index 9daf2b23..b78b5aa9 100644 --- a/compensation/tables.py +++ b/compensation/tables.py @@ -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, ) diff --git a/compensation/templates/compensation/detail/eco_account/includes/actions.html b/compensation/templates/compensation/detail/eco_account/includes/actions.html index c5b9c1c1..67dd2bbf 100644 --- a/compensation/templates/compensation/detail/eco_account/includes/actions.html +++ b/compensation/templates/compensation/detail/eco_account/includes/actions.html @@ -11,7 +11,7 @@
{% if is_default_member and has_access %} - @@ -58,7 +58,7 @@ {{ action.comment|default_if_none:"" }} {% if is_default_member and has_access %} - {% endif %} diff --git a/compensation/templates/compensation/detail/eco_account/includes/controls.html b/compensation/templates/compensation/detail/eco_account/includes/controls.html index f43ddebe..fcc70dc2 100644 --- a/compensation/templates/compensation/detail/eco_account/includes/controls.html +++ b/compensation/templates/compensation/detail/eco_account/includes/controls.html @@ -6,36 +6,36 @@ LANIS - + {% if has_access %} - {% if is_ets_member %} {% if obj.recorded %} - {% else %} - {% endif %} {% endif %} {% if is_default_member %} - + - - {% endif %} diff --git a/compensation/templates/compensation/detail/eco_account/includes/deadlines.html b/compensation/templates/compensation/detail/eco_account/includes/deadlines.html index 4bf26df6..a1764df8 100644 --- a/compensation/templates/compensation/detail/eco_account/includes/deadlines.html +++ b/compensation/templates/compensation/detail/eco_account/includes/deadlines.html @@ -11,7 +11,7 @@
{% if is_default_member and has_access %} - @@ -48,7 +48,7 @@ {{ deadline.comment }} {% if is_default_member and has_access %} - {% endif %} diff --git a/compensation/templates/compensation/detail/eco_account/includes/deductions.html b/compensation/templates/compensation/detail/eco_account/includes/deductions.html index 16b9cb75..ca97f005 100644 --- a/compensation/templates/compensation/detail/eco_account/includes/deductions.html +++ b/compensation/templates/compensation/detail/eco_account/includes/deductions.html @@ -11,7 +11,7 @@
{% if is_default_member and has_access %} - @@ -60,7 +60,7 @@ {{ deduction.created.timestamp|default_if_none:""|naturalday}} {% if is_default_member and has_access %} - {% endif %} diff --git a/compensation/templates/compensation/detail/eco_account/includes/documents.html b/compensation/templates/compensation/detail/eco_account/includes/documents.html index bd371df2..f6376f46 100644 --- a/compensation/templates/compensation/detail/eco_account/includes/documents.html +++ b/compensation/templates/compensation/detail/eco_account/includes/documents.html @@ -11,7 +11,7 @@
{% if is_default_member and has_access %} - @@ -39,14 +39,14 @@ {% for doc in obj.documents.all %} - + {{ doc.title }} {{ doc.comment }} {% if is_default_member and has_access %} - {% endif %} diff --git a/compensation/templates/compensation/detail/eco_account/includes/states-after.html b/compensation/templates/compensation/detail/eco_account/includes/states-after.html index 70a36018..17e7d44a 100644 --- a/compensation/templates/compensation/detail/eco_account/includes/states-after.html +++ b/compensation/templates/compensation/detail/eco_account/includes/states-after.html @@ -11,7 +11,7 @@
{% if is_default_member and has_access %} - @@ -61,7 +61,7 @@ {{ state.surface|floatformat:2 }} m² {% if is_default_member and has_access %} - {% endif %} diff --git a/compensation/templates/compensation/detail/eco_account/includes/states-before.html b/compensation/templates/compensation/detail/eco_account/includes/states-before.html index 5482674a..3a1136ca 100644 --- a/compensation/templates/compensation/detail/eco_account/includes/states-before.html +++ b/compensation/templates/compensation/detail/eco_account/includes/states-before.html @@ -11,7 +11,7 @@
{% if is_default_member and has_access %} - @@ -61,7 +61,7 @@ {{ state.surface|floatformat:2 }} m² {% if is_default_member and has_access %} - {% endif %} diff --git a/compensation/templates/compensation/detail/eco_account/view.html b/compensation/templates/compensation/detail/eco_account/view.html index 493a9292..033eda33 100644 --- a/compensation/templates/compensation/detail/eco_account/view.html +++ b/compensation/templates/compensation/detail/eco_account/view.html @@ -102,28 +102,30 @@

-
-
- {% include 'compensation/detail/eco_account/includes/states-before.html' %} +
- -
-
- {% include 'ema/detail/includes/states-before.html' %} +