If you don't inline a model, you can select an existing instance to associate with, but you can't create a new instance. If you do inline a model, you can create a new instance to associate with, but you can't associate with an existing instance. Am I mistaken?
It would be nice if I could get both the inlined and non-inlined version of the field at the same time, so I could associate with existing items AND create new items inline.
This could be implemented by just showing both the select field and the "Add X" button. In this case, models would only be inlined when they are being created, and they would move to the non-inlined select interface when you returned to edit the parent record.
It would be kind of cool to allow the user to dynamically choose to edit one of the child documents by clicking on an "edit" link while editing some other document. That way they could freely edit sub-documents without having to re-post the entire collection of sub-documents.
I agree, this would be a very good feature. Analog to Django, see Figure 6-13 at http://www.djangobook.com/en/2.0/chapter06.html where you have the "green plus"-feature.
Bumping almost 2 years later. That could be really useful for me. Did any of you guys come up with something?
Another 6 months later, and now I need this feature, too!
From what I can make out, this shouldn't be too hard to implement. We already have the "create" modal for use when create_modal == True; we could use code similar to the one used in that case. I'm thinking something like this:
modals/create.html page insidePerhaps we could also add a Gmail-style "foobar (add new)" in the select2 list like what shows eg. while setting labels in Gmail.
@badrihippo the proposal sound great. A PR would be welcome.
@badrihippo the proposal sound great. A PR would be welcome.
I'm not working with Flask or flask-admin right now, but I'll get back when I have the time. (If anyone else wants to implement it before that, they're welcome).
Most helpful comment
Another 6 months later, and now I need this feature, too!
From what I can make out, this shouldn't be too hard to implement. We already have the "create" modal for use when
create_modal == True; we could use code similar to the one used in that case. I'm thinking something like this:modals/create.htmlpage insideinto the list of select/select2 options, and also gets set as the currently selected option.
Perhaps we could also add a Gmail-style "foobar (add new)" in the select2 list like what shows eg. while setting labels in Gmail.