Improve relationship support in sprox/tgext.crud

20 views
Skip to first unread message

Moritz Schlarb

unread,
Apr 19, 2013, 5:15:35 AM4/19/13
to sp...@googlegroups.com, turbogea...@googlegroups.com
I talked a bit with Alessandro about this, and we thought it would be something worth to discuss here:

We plan on improving the support for all-kinds of relationship things:
  • Improve searching for related entities in get_all by allowing to search for name
    (I basically already implemented that in my project and would just need to backport that to sprox/tgext.crud themselves)
  • Improve sorting on relationship columns
  • Add support for creating related entities directly from the add/edit page of the parent entity
    (That would be so awesome!)
Does anyone else think of other useful features in this context?

Cheers,
Moritz

Alessandro Molina

unread,
Apr 19, 2013, 5:51:56 AM4/19/13
to tg-trunk
Just my two cents :D

- Many of those features require javascript, sooner or later we will have to make a decision on what to use.
If I'm not wrong, Moritz, in his project, implemented the search for related entities using select2, which requires jQuery.
Porting that implementation to crud would mean making crud jQuery based.
I don't know if it makes sense to provide a way to enable/disable js features or just let the user replace the template if he doesn't want to use them.

- On the add/edit nested feature has anyone ever looked at how is done in Flask-Admin and Django?
I remember having looked at the Flask-Admin source code some time ago and I didn't like much their solution of implementing nested forms by adding some hidden fields to the parent form with specific ids. 

I didn't do much research on this topic, but it feels like it might be a perfect match for tgext.ajaxforms. It should be quite easy to load the forms of the child entity and submit them using tgext.ajaxforms. We probably just need a way to update the parent single select or multiple selection by adding the newly created entity on the fly.


--
You received this message because you are subscribed to the Google Groups "sprox" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sprox+un...@googlegroups.com.
To post to this group, send email to sp...@googlegroups.com.
Visit this group at http://groups.google.com/group/sprox?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Chris Perkins

unread,
Apr 19, 2013, 11:03:53 AM4/19/13
to sp...@googlegroups.com, turbogea...@googlegroups.com
Moritz,

Great to see some activity in this area.  I actually have implemented parent entity addition with tgext.subform, so be sure to check that out.  If you want I can provide commit access if you want to implement editing.  I agree that searching could be improved, but from what I have seen so far, the existing searching mechanism needs to be solidified because it has caused some bugs in projects I have worked on.  Next time I encounter these bugs I will file the requisite tickets.

Thanks again for your efforts.

cheers.
-chris


--

Alessandro Molina

unread,
Apr 19, 2013, 1:59:31 PM4/19/13
to sprox, tg-trunk
I think that we can take two things from tgext.subform which would make sense by themselves in crud:
 - The validate method: it makes sense even in other contexts to have a method that can be used to validate data to create an entry.
 - The idea of json based post: Instead of having a subtype_post method we can probably just check the X-Requested-With Header to choose if it is the case to return a json response or the redirect.

On the form side the issue is that tgext.subform relies on TW1, which is not going to see py3 support and is somehow deprecated. 
Also I think we can achieve the same result with less effort, loading the nested form can probably be performed with just loading with something like jQuery.load the form add_form.display() without any template.

Should we probably keep the subfields editing discussion on tg-trunk alone as it actually relates more to tgext.crud than to sprox itself?

Moritz Schlarb

unread,
Apr 19, 2013, 4:23:48 PM4/19/13
to turbogea...@googlegroups.com
Hey Chris,

could you maybe add some little docs to tgext.subform?
At the moment it looks to me as if subform and ajaxform would basically do the same?!

And an other question that came up recently: What's up with your Github account?
I saw that you have the sprox-docs there, which could use at least some version bumping. ;)

Cheers,
Moritz
Reply all
Reply to author
Forward
0 new messages