|
|
@ -85,7 +85,6 @@ def create_item(request):
|
|
|
|
for err in form_errors:
|
|
|
|
for err in form_errors:
|
|
|
|
err_data = form_errors[err][0]
|
|
|
|
err_data = form_errors[err][0]
|
|
|
|
messages.error(request, f'{err}: {err_data["message"]}')
|
|
|
|
messages.error(request, f'{err}: {err_data["message"]}')
|
|
|
|
return HttpResponseRedirect(reverse('create_item'))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context = {
|
|
|
|
context = {
|
|
|
|
'form': CreateItemForm(request.POST or None),
|
|
|
|
'form': CreateItemForm(request.POST or None),
|
|
|
@ -128,8 +127,7 @@ def edit_item(request, item_id):
|
|
|
|
for err in form_errors:
|
|
|
|
for err in form_errors:
|
|
|
|
err_data = form_errors[err][0]
|
|
|
|
err_data = form_errors[err][0]
|
|
|
|
messages.error(request, f'{err}: {err_data["message"]}')
|
|
|
|
messages.error(request, f'{err}: {err_data["message"]}')
|
|
|
|
return HttpResponseRedirect(reverse('get_item', args=[item_id]))
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
context = {
|
|
|
|
context = {
|
|
|
|
'form': CreateItemForm(instance=item),
|
|
|
|
'form': CreateItemForm(instance=item),
|
|
|
|
'formset': ItemImageFormSet(instance=item)
|
|
|
|
'formset': ItemImageFormSet(instance=item)
|
|
|
|