mirror of
https://github.com/pretix/pretix.git
synced 2026-05-09 15:54:03 +00:00
Fixed adding an item picture at creation time
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import sys
|
import sys
|
||||||
|
import uuid
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
@@ -66,9 +67,9 @@ class ItemCategory(LoggedModel):
|
|||||||
|
|
||||||
|
|
||||||
def itempicture_upload_to(instance, filename: str) -> str:
|
def itempicture_upload_to(instance, filename: str) -> str:
|
||||||
return '%s/%s/item-%s.%s' % (
|
return '%s/%s/item-%s-%s.%s' % (
|
||||||
instance.event.organizer.slug, instance.event.slug, instance.id,
|
instance.event.organizer.slug, instance.event.slug, instance.id,
|
||||||
filename.split('.')[-1]
|
str(uuid.uuid4()), filename.split('.')[-1]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -582,7 +582,12 @@ class ItemCreate(EventPermissionRequiredMixin, CreateView):
|
|||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
messages.success(self.request, _('Your changes have been saved.'))
|
messages.success(self.request, _('Your changes have been saved.'))
|
||||||
ret = super().form_valid(form)
|
ret = super().form_valid(form)
|
||||||
form.instance.log_action('pretix.event.item.added', user=self.request.user, data=dict(form.cleaned_data))
|
form.instance.log_action('pretix.event.item.added', user=self.request.user, data={
|
||||||
|
k: (form.cleaned_data.get(k).name
|
||||||
|
if isinstance(form.cleaned_data.get(k), File)
|
||||||
|
else form.cleaned_data.get(k))
|
||||||
|
for k in form.changed_data
|
||||||
|
})
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def get_form_kwargs(self):
|
def get_form_kwargs(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user