Not sure understanding you suggestion In which case ? available_categories is an unresolved query until too late Could you please elaborate ? Thanks
On Friday, December 16, 2016 at 8:35:56 PM UTC+1, Anthony wrote: > > On Friday, December 16, 2016 at 7:32:21 AM UTC-5, icodk wrote: >> >> There is a little problem with the original solution: If all categories >> are already assigned to specific item, it is not possible to edit any of >> the assignment. >> because the drop down list is empty. This is not a problem if you do not >> have any other fields (ex. comment) attached to the assignment, you can >> just delete it and reasigne the same category if you wish. It is solved by >> building on top of Antony's idea by including the current category in the >> available categories in case of edit: >> > > Good point. You could also set the category field as readonly in this case. > > >> The next challenge will be to remove the "Add new record" button from the >> grid in case all categories are assigned. This can probably done by >> counting the available categories and counting the assigned categories just >> before showing the grid. If they are equal then there is no need to show >> the add button (create =False) >> > > Just check available_categories.isempty(). > > Anthony > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

