Skip to content
Snippets Groups Projects
Verified Commit 74669d05 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Fix IntivePersonByID view

parent f1c9b0b1
No related branches found
No related tags found
1 merge request!954Resolve "AttributeError 'InvitePersonByID' object has no attribute 'ge..."
Pipeline #53474 passed
......@@ -9,6 +9,11 @@ and this project adheres to `Semantic Versioning`_.
Unreleased
----------
Fixed
~~~~~
* Inviting newly created persons for registration failed
`2.7.3`_ - 2022-02-03
---------------------
......
......@@ -63,7 +63,7 @@ urlpatterns = [
path("person/<int:id_>/", views.person, name="person_by_id"),
path("person/<int:pk>/edit/", views.EditPersonView.as_view(), name="edit_person_by_id"),
path("person/<int:id_>/delete/", views.delete_person, name="delete_person_by_id"),
path("person/<int:id_>/invite/", views.InvitePersonByID.as_view(), name="invite_person_by_id"),
path("person/<int:pk>/invite/", views.InvitePersonByID.as_view(), name="invite_person_by_id"),
path("groups", views.groups, name="groups"),
path("groups/additional_fields", views.additional_fields, name="additional_fields"),
path("groups/child_groups/", views.groups_child_groups, name="groups_child_groups"),
......
......@@ -1421,15 +1421,13 @@ class AccountRegisterView(SignupView):
return kwargs
class InvitePersonByID(View):
class InvitePersonByID(SingleObjectMixin, View):
"""Custom view to invite person by their ID."""
success_url = reverse_lazy("persons")
model = Person
def get(self, request, *args, **kwargs):
self.object = self.get_object()
success_url = reverze_lazy("person_by_id", self.object.pk)
person = self.object
person = self.get_object()
if not PersonInvitation.objects.filter(email=person.email).exists():
length = get_site_preferences()["auth__invite_code_length"]
......@@ -1446,7 +1444,7 @@ class InvitePersonByID(View):
else:
messages.success(self.request, _("Person was already invited."))
return HttpResponseRedirect(success_url)
return HttpResponseRedirect(person.get_absolute_url())
class LoginView(AllAuthLoginView):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment