Image not displayed after Django form save -


i have formset (more generic inline formset) forms have imagefield. after working around seems few django bugs, working fine, except when fill blank form new image , click save, page refreshes after post request , new image not there. other fields of form saved there , filled, image url doesn't show up. database record saved correctly , if refresh page, image shows correctly. can't figure out how return post newly saved information without having refresh page time.

in case it's relevant, imagefield using custom storage class handles saving image in remote server through api.

a workaround solves problem in opinion shouldn't necessary:

class productimagesview(view):     ...     def post(self, request, id):         product = get_object_or_404(product.objects.by_id(id))         image_formset = productimageinlineformset(             request.post, request.files, instance=product)         if image_formset.is_valid():             image_formset.save()          image_formset = productimageinlineformset(instance=product)  # workaround         return render(...) 

you can find more details code in other question:

any idea why happening? doing wrong or django bug? thanks.

update

one thing forgot say: formset shows after saving not has blank image field newly created image object, doesn't have blank form new records should there. appears after refresh.

(i pass extra=1 generic_inlineformset_factory):

productimageinlineformset = generic_inlineformset_factory(     image, form=productimageform, extra=1) 


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -