| @@ 110-124 (lines=15) @@ | ||
| 107 | return template |
|
| 108 | return DISPLAY_TEMPLATE |
|
| 109 | ||
| 110 | def get_value(self): |
|
| 111 | """Extract the value from the request or get it from the field |
|
| 112 | """ |
|
| 113 | # get the processed value from the `update` method |
|
| 114 | value = self.value |
|
| 115 | # the value might come from the request, e.g. on object creation |
|
| 116 | if api.is_string(value): |
|
| 117 | value = IDataConverter(self).toFieldValue(value) |
|
| 118 | # we handle always lists in the templates |
|
| 119 | if value is None: |
|
| 120 | return [] |
|
| 121 | if not isinstance(value, (list, tuple)): |
|
| 122 | value = [value] |
|
| 123 | # just to be sure (paranoid) |
|
| 124 | return [uid for uid in value if api.is_uid(uid)] |
|
| 125 | ||
| 126 | def get_render_data(self, context, field, uid): |
|
| 127 | """Provides the needed data to render the display template from the UID |
|
| @@ 248-261 (lines=14) @@ | ||
| 245 | ||
| 246 | return catalog_name |
|
| 247 | ||
| 248 | def get_value(self): |
|
| 249 | """Extract the value from the request or get it from the field |
|
| 250 | """ |
|
| 251 | # get the processed value from the `update` method |
|
| 252 | value = self.value |
|
| 253 | # the value might come from the request, e.g. on object creation |
|
| 254 | if api.is_string(value): |
|
| 255 | value = IDataConverter(self).toFieldValue(value) |
|
| 256 | # we handle always lists in the templates |
|
| 257 | if value is None: |
|
| 258 | return [] |
|
| 259 | if not isinstance(value, (list, tuple)): |
|
| 260 | value = [value] |
|
| 261 | return value |
|
| 262 | ||
| 263 | def get_render_data(self, context, field, reference): |
|
| 264 | """Provides the needed data to render the display template |
|