130 Example : |
130 Example : |
131 |
131 |
132 class ProjectScreenshotsView(EntityRelationView): |
132 class ProjectScreenshotsView(EntityRelationView): |
133 '''display project's screenshots''' |
133 '''display project's screenshots''' |
134 id = title = _('projectscreenshots') |
134 id = title = _('projectscreenshots') |
135 __selectors__ = implements('Project') |
135 __select__ = implements('Project') |
136 rtype = 'screenshot' |
136 rtype = 'screenshot' |
137 target = 'object' |
137 target = 'object' |
138 vid = 'gallery' |
138 vid = 'gallery' |
139 __selectors__ = EntityRelationView.__selectors__ + (one_line_rset,) |
|
140 |
|
141 |
139 |
142 This is the view we want to have in a tab, only if there is something to show. |
140 This is the view we want to have in a tab, only if there is something to show. |
143 Then, just define as below, and declare this being the tab content : |
141 Then, just define as below, and declare this being the tab content : |
144 |
142 |
145 class ProjectScreenshotTab(DataDependantTab, ProjectScreenshotsView): |
143 class ProjectScreenshotTab(DataDependantTab, ProjectScreenshotsView): |
146 id = 'screenshots_tab' |
144 id = 'screenshots_tab' |
147 """ |
145 """ |
148 __selectors__ = EntityView.__selectors__ + (has_related_entities,) |
146 __select__ = EntityView.__select__ & (has_related_entities,) |
149 vid = 'list' |
147 vid = 'list' |
150 |
148 |
151 def cell_call(self, row, col): |
149 def cell_call(self, row, col): |
152 rset = self.entity(row, col).related(self.rtype, role(self)) |
150 rset = self.entity(row, col).related(self.rtype, role(self)) |
153 self.w(u'<div class="mainInfo">') |
151 self.w(u'<div class="mainInfo">') |