Thank you for all for your valuable input. I've created some simple data modeling system example (which mimics file tree with drives, folders and files) so that we have objects with lists of other objects. Those interested may find this example here: http://github.com/lispercat/filetree.
Andrei On Apr 13, 6:32 pm, Trastabuga <[email protected]> wrote: > I need some pointers on how to implement a system with 1->many > relationship between the objects. > Let's say we have a grid of blog posts which we instantiate with a > grid widget: > (make-instance 'gridedit > :name 'posts-grid > :data-class 'post > .......................... > :view 'post-table-view > :item-data-view 'post-data-view > :item-form-view 'post-form-view)) > > When we drill into a "post" item, we'll get presented with post-form- > view which uses post class as scaffolding: > (defview post-form-view (:type form :inherit-from '(:scaffold > post)) ....) > Now I want to add "replies" to the post so that post class would look > something like > > (defclass post () > ((id) > ...... > ...... > (replies :accessor post-replies > :initarg nil > :initform nil > :type post ;;(or some other type) > :documentation "replies to the post"))) > > How do I add the ability for post-form-view to add/delete the replies? > I tried extending post-form-view to look like > > (defview reply-table-view (:type table :inherit-from '(:scaffold > post)) > (id :hidep t)) > > (defview post-form-view (:type form :inherit-from '(:scaffold post)) > ...... > (replies:type mixin :view 'reply-table-view)) > > But this doesn't work giving an error that some function is nil (which > is really hard to say which function is missing and where from looking > at the debug output). > Looks like I am missing something in understanding of how views work. > Please, nudge me in right direction. > In general, I am looking for a generic method of creating a tree of > persistent objects using views > (something like root->obj_level1_1 > obj_level1_2 > obj_level1_3->obj_level2_1 > obj_level2_2 > ................. > obj_level2_N > ................. > obj_level1_M > > I specified two levels here (like posts->replies) but in general there > could be any number of levels) > > Thank you, > Andrei -- You received this message because you are subscribed to the Google Groups "weblocks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/weblocks?hl=en.
