mirror of
https://github.com/pretix/pretix.git
synced 2026-05-06 15:24:02 +00:00
Allow admin to manually change order email
This commit is contained in:
@@ -32,7 +32,8 @@ from pretix.base.signals import (
|
||||
register_ticket_outputs,
|
||||
)
|
||||
from pretix.control.forms.orders import (
|
||||
CommentForm, ExporterForm, ExtendForm, OrderPositionChangeForm,
|
||||
CommentForm, ExporterForm, ExtendForm, OrderContactForm,
|
||||
OrderPositionChangeForm,
|
||||
)
|
||||
from pretix.control.permissions import EventPermissionRequiredMixin
|
||||
from pretix.multidomain.urlreverse import build_absolute_uri
|
||||
@@ -536,6 +537,34 @@ class OrderChange(OrderView):
|
||||
return self.get(*args, **kwargs)
|
||||
|
||||
|
||||
class OrderContactChange(OrderView):
|
||||
permission = 'can_change_orders'
|
||||
template_name = 'pretixcontrol/order/change_contact.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
ctx = super().get_context_data()
|
||||
ctx['form'] = self.form
|
||||
return ctx
|
||||
|
||||
@cached_property
|
||||
def form(self):
|
||||
return OrderContactForm(
|
||||
instance=self.order,
|
||||
data=self.request.POST if self.request.method == "POST" else None
|
||||
)
|
||||
|
||||
def post(self, *args, **kwargs):
|
||||
if self.form.is_valid():
|
||||
self.order.log_action('pretix.event.order.contact.changed', {
|
||||
'old_email': self.order.email,
|
||||
'new_email': self.form.cleaned_data['email']
|
||||
})
|
||||
self.form.save()
|
||||
messages.success(self.request, _('The order has been changed.'))
|
||||
return redirect(self.get_order_url())
|
||||
return self.get(*args, **kwargs)
|
||||
|
||||
|
||||
class OverView(EventPermissionRequiredMixin, TemplateView):
|
||||
template_name = 'pretixcontrol/orders/overview.html'
|
||||
permission = 'can_view_orders'
|
||||
|
||||
Reference in New Issue
Block a user