diff --git a/passbook/admin/templates/administration/invite/list.html b/passbook/admin/templates/administration/invitation/list.html similarity index 70% rename from passbook/admin/templates/administration/invite/list.html rename to passbook/admin/templates/administration/invitation/list.html index ae7b7d46b..d3ab34faf 100644 --- a/passbook/admin/templates/administration/invite/list.html +++ b/passbook/admin/templates/administration/invitation/list.html @@ -17,18 +17,17 @@ - - + + {% for invitation in object_list %} - - + + diff --git a/passbook/admin/urls.py b/passbook/admin/urls.py index 300db95ae..2133b1bce 100644 --- a/passbook/admin/urls.py +++ b/passbook/admin/urls.py @@ -37,8 +37,6 @@ urlpatterns = [ # Invitations path('invitations/', invitations.InviteListView.as_view(), name='invitations'), path('invitations/create/', invitations.InviteCreateView.as_view(), name='invitation-create'), - path('invitations//update/', - invitations.InviteUpdateView.as_view(), name='invitation-update'), path('invitations//delete/', invitations.InviteDeleteView.as_view(), name='invitation-delete'), # path('api/v1/', include('passbook.admin.api.v1.urls')) diff --git a/passbook/admin/views/invitations.py b/passbook/admin/views/invitations.py index e4a50a899..a34f47854 100644 --- a/passbook/admin/views/invitations.py +++ b/passbook/admin/views/invitations.py @@ -24,15 +24,10 @@ class InviteCreateView(SuccessMessageMixin, AdminRequiredMixin, CreateView): success_message = _('Successfully created Invite') form_class = InviteForm - -class InviteUpdateView(SuccessMessageMixin, AdminRequiredMixin, UpdateView): - """Update invitation""" - - model = Invite - template_name = 'generic/update.html' - success_url = reverse_lazy('passbook_admin:invitations') - success_message = _('Successfully updated Invite') - form_class = InviteForm + def get_initial(self): + return { + 'created_by': self.request.user + } class InviteDeleteView(SuccessMessageMixin, AdminRequiredMixin, DeleteView): """Delete invitation""" diff --git a/passbook/core/forms/invitations.py b/passbook/core/forms/invitations.py index 0a23b1792..d6118da6e 100644 --- a/passbook/core/forms/invitations.py +++ b/passbook/core/forms/invitations.py @@ -11,4 +11,13 @@ class InviteForm(forms.ModelForm): class Meta: model = Invite - fields = '__all__' + fields = ['created_by', 'expires', 'fixed_username', 'fixed_email'] + labels = { + 'fixed_username': "Force user's username (optional)", + 'fixed_email': "Force user's email (optional)", + } + widgets = { + 'created_by': forms.Select(attrs={'disabled': 'disabled'}), + 'fixed_username': forms.TextInput(), + 'fixed_email': forms.TextInput(), + }
{% trans 'Name' %}{% trans 'Provider' %}{% trans 'Expiry' %}{% trans 'Link' %}
{{ invitation.name }}{{ invitation.provider }}{{ invitation.expires|default:"Never" }}
test
- {% trans 'Edit' %} {% trans 'Delete' %}