Monday, February 8, 2016

Re: Add model item with AJAX pop up

hi
easiest way is to write separate view which will handle ajax requests (get and post) and render html (as a json field) and success status as response.
on frontend you will handle this response to show modal with form and submit it until model will successfully saved
once it happens, you can refetch your users list in select field

but I don't know any application which implement all this stack. I think you should handle this modal by yourself

On Saturday, February 6, 2016 at 4:12:48 PM UTC+3, guettli wrote:

I use django-select2 for easy ForeignKey picking. Works nice.


But how can I add a new item in the ForeignKey table?


I would like to have a big [+] button near the select2 field and then a (ajax) modal dialog should open (like in the admin interface).


AFAIK django-select2 does not help here. Is there a different library which can help here?


I would like to re-use and not to re-invent. Maybe I was blind, but I could not

find a matching comparison grid on djangopackages.com.


I would like to avoid a "old-school" browser-window-pop-up :-)


Regards,

  Thomas Güttler

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2e4db59a-48b2-4108-a576-3e443df8cd14%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment