Changeset View
Changeset View
Standalone View
Standalone View
common/mixins.py
| Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | def save_formset(self, request: Any, form: Any, formset: Any, change: Any) -> None: | ||||
| super().save_formset(request, form, formset, change) | super().save_formset(request, form, formset, change) | ||||
| class ViewOnSiteMixin: | class ViewOnSiteMixin: | ||||
| """Add `view_link` attribute to model admin.""" | """Add `view_link` attribute to model admin.""" | ||||
| def view_link(self, obj): | def view_link(self, obj): | ||||
| """Render a link to a given object.""" | """Render a link to a given object.""" | ||||
| if not obj: | |||||
| return | |||||
| return mark_safe('<a href="{0}">{1}</a>'.format(obj.get_absolute_url(), "View on site")) | return mark_safe('<a href="{0}">{1}</a>'.format(obj.get_absolute_url(), "View on site")) | ||||
| view_link.allow_tags = True | view_link.allow_tags = True | ||||
| view_link.short_description = "View on site" | view_link.short_description = "View on site" | ||||
| class StaticThumbnailURLMixin: | class StaticThumbnailURLMixin: | ||||
| """Add `thumbnail_<size>_url` properties generating static cacheable thumbnail URLs.""" | """Add `thumbnail_<size>_url` properties generating static cacheable thumbnail URLs.""" | ||||
| Show All 38 Lines | |||||