|
3 | 3 | from django.utils.html import format_html
|
4 | 4 |
|
5 | 5 |
|
6 |
| -from mod_app.models import ProjectNote, Feedback |
| 6 | +from mod_app.models import ProjectNote, Feedback, VisualWrittenInfluences |
| 7 | +from mod_app.utils.mixins import s3BrowserButtonMixin |
7 | 8 |
|
8 | 9 |
|
9 | 10 | @admin.register(ProjectNote)
|
@@ -42,31 +43,31 @@ def safe_content(self, obj):
|
42 | 43 | safe_content.short_description = "Content"
|
43 | 44 |
|
44 | 45 |
|
45 |
| -# class VWIInline(s3BrowserButtonMixin, admin.TabularInline): |
46 |
| -# model = VisualWrittenInfluences.films.through |
47 |
| -# extra = 1 |
48 |
| -# classes = [ |
49 |
| -# "grp-collapse", |
50 |
| -# "grp-open", |
51 |
| -# ] |
52 |
| -# verbose_name = "Visual & Written Influences" |
53 |
| -# verbose_name_plural = "Visual & Written Influences" |
| 46 | +class VWIInline(s3BrowserButtonMixin, admin.TabularInline): |
| 47 | + model = VisualWrittenInfluences.films.through |
| 48 | + extra = 1 |
| 49 | + classes = [ |
| 50 | + "grp-collapse", |
| 51 | + "grp-open", |
| 52 | + ] |
| 53 | + verbose_name = "Visual & Written Influences" |
| 54 | + verbose_name_plural = "Visual & Written Influences" |
54 | 55 |
|
55 | 56 |
|
56 |
| -# @admin.register(VisualWrittenInfluences) |
57 |
| -# class VWIAdmin(s3BrowserButtonMixin, admin.ModelAdmin): |
58 |
| -# class Media: |
59 |
| -# js = ("admin/js/mentionsPluginConfig.js",) |
| 57 | +@admin.register(VisualWrittenInfluences) |
| 58 | +class VWIAdmin(s3BrowserButtonMixin, admin.ModelAdmin): |
| 59 | + class Media: |
| 60 | + js = ("admin/js/mentionsPluginConfig.js",) |
60 | 61 |
|
61 |
| -# search_fields = ["title"] |
62 |
| -# list_display = ["title", "safe_content"] |
63 |
| -# readonly_fields = ("bibliography",) |
64 |
| -# filter_horizontal = ("films",) |
| 62 | + search_fields = ["title"] |
| 63 | + list_display = ["title", "safe_content"] |
| 64 | + readonly_fields = ("bibliography",) |
| 65 | + filter_horizontal = ("films",) |
65 | 66 |
|
66 |
| -# def safe_content(self, obj): |
67 |
| -# truncated_content = truncatechars_html(obj.content, 200) |
68 |
| -# modified_content = truncated_content.replace("{", "(").replace("}", ")") |
69 |
| -# return format_html(modified_content) |
| 67 | + def safe_content(self, obj): |
| 68 | + truncated_content = truncatechars_html(obj.content, 200) |
| 69 | + modified_content = truncated_content.replace("{", "(").replace("}", ")") |
| 70 | + return format_html(modified_content) |
70 | 71 |
|
71 |
| -# safe_content.allow_tags = True |
72 |
| -# safe_content.short_description = "Content" |
| 72 | + safe_content.allow_tags = True |
| 73 | + safe_content.short_description = "Content" |
0 commit comments