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 @@