Skip to content

Commit 46a72dc

Browse files
authored
Merge pull request #136 from UCL-ARC/development
Updating Production
2 parents 25b3e71 + 2fc0d6b commit 46a72dc

26 files changed

+646
-10
lines changed

dashboard.py

+2
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ def init_with_context(self, context):
8686
"mod_app.models.support_models.OtherLink",
8787
"mod_app.models.support_models.Tag",
8888
"mod_app.models.feedback_model.Feedback",
89+
"mod_app.models.visual_written_influences_model.VisualInfluences",
90+
"mod_app.models.visual_written_influences_model.WrittenInfluences",
8991
),
9092
),
9193
],

mod_app/admin/film_admin.py

+27-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
StillInline,
1919
VideoInline,
2020
)
21+
from mod_app.admin.note_admin import VisInline, WritInline
2122
from mod_app.utils.mixins import EmailMixin
2223

2324
from ..models import Analysis, TeachingResources, Film
@@ -55,6 +56,7 @@ class Media:
5556

5657
autocomplete_fields = ["genre"]
5758
search_fields = [
59+
"bfi_identifier",
5860
"title",
5961
"alt_titles",
6062
"production_company",
@@ -70,6 +72,8 @@ class Media:
7072
inlines = [
7173
FilmAnalysisInline,
7274
TRInline,
75+
VisInline,
76+
WritInline,
7377
SourceInline,
7478
OtherLinkInline,
7579
VideoInline,
@@ -84,6 +88,7 @@ class Media:
8488
]
8589
list_display = [
8690
"title",
91+
"bfi_identifier",
8792
"safe_temporary_images",
8893
"preview_video",
8994
"safe_alt_titles",
@@ -155,7 +160,10 @@ def preview_video(self, obj):
155160
"fields": (
156161
"title",
157162
"alt_titles",
158-
"release_date",
163+
(
164+
"bfi_identifier",
165+
"release_date",
166+
),
159167
("production_country", "production_company"),
160168
"synopsis",
161169
("cast", "crew"),
@@ -203,6 +211,24 @@ def preview_video(self, obj):
203211
None,
204212
{"classes": ("placeholder TeachingResources_films-group",), "fields": ()},
205213
),
214+
(
215+
"Visual & Written Influences",
216+
{"fields": []},
217+
),
218+
(
219+
None,
220+
{
221+
"classes": ("placeholder VisualInfluences_films-group",),
222+
"fields": (),
223+
},
224+
),
225+
(
226+
None,
227+
{
228+
"classes": ("placeholder WrittenInfluences_films-group",),
229+
"fields": (),
230+
},
231+
),
206232
(
207233
"Comments and List Images",
208234
{

mod_app/admin/note_admin.py

+62-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
from django.utils.html import format_html
44

55

6-
from mod_app.models import ProjectNote, Feedback
6+
from mod_app.models import ProjectNote, Feedback, VisualInfluences, WrittenInfluences
7+
from mod_app.utils.mixins import s3BrowserButtonMixin
78

89

910
@admin.register(ProjectNote)
@@ -40,3 +41,63 @@ def safe_content(self, obj):
4041

4142
safe_content.allow_tags = True
4243
safe_content.short_description = "Content"
44+
45+
46+
class VisInline(s3BrowserButtonMixin, admin.TabularInline):
47+
model = VisualInfluences.films.through
48+
extra = 1
49+
classes = [
50+
"grp-collapse",
51+
"grp-open",
52+
]
53+
verbose_name = "Visual Influences"
54+
verbose_name_plural = "Visual Influences"
55+
56+
57+
class WritInline(s3BrowserButtonMixin, admin.TabularInline):
58+
model = WrittenInfluences.films.through
59+
extra = 1
60+
classes = [
61+
"grp-collapse",
62+
"grp-open",
63+
]
64+
verbose_name = "Written Influences"
65+
verbose_name_plural = "Written Influences"
66+
67+
68+
@admin.register(VisualInfluences)
69+
class VisualInfluencesAdmin(s3BrowserButtonMixin, admin.ModelAdmin):
70+
class Media:
71+
js = ("admin/js/mentionsPluginConfig.js",)
72+
73+
search_fields = ["title"]
74+
list_display = ["title", "safe_content"]
75+
readonly_fields = ("bibliography",)
76+
filter_horizontal = ("films",)
77+
78+
def safe_content(self, obj):
79+
truncated_content = truncatechars_html(obj.content, 200)
80+
modified_content = truncated_content.replace("{", "(").replace("}", ")")
81+
return format_html(modified_content)
82+
83+
safe_content.allow_tags = True
84+
safe_content.short_description = "Content"
85+
86+
87+
@admin.register(WrittenInfluences)
88+
class WrittenInfluencesAdmin(s3BrowserButtonMixin, admin.ModelAdmin):
89+
class Media:
90+
js = ("admin/js/mentionsPluginConfig.js",)
91+
92+
search_fields = ["title"]
93+
list_display = ["title", "safe_content"]
94+
readonly_fields = ("bibliography",)
95+
filter_horizontal = ("films",)
96+
97+
def safe_content(self, obj):
98+
truncated_content = truncatechars_html(obj.content, 200)
99+
modified_content = truncated_content.replace("{", "(").replace("}", ")")
100+
return format_html(modified_content)
101+
102+
safe_content.allow_tags = True
103+
safe_content.short_description = "Content"

mod_app/admin/teaching_analysis_admin.py

+2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class Media:
5656
"list_tags",
5757
"safe_content",
5858
]
59+
filter_horizontal = ("films",)
5960

6061
def dynamic_title(self, obj):
6162
return obj.__str__()
@@ -116,6 +117,7 @@ class Media:
116117
autocomplete_fields = ["films", "topics", "tags", "clips"]
117118
readonly_fields = ("safe_bibliography",)
118119
exclude = ["bibliography"]
120+
filter_horizontal = ("films",)
119121

120122
list_display = [
121123
"dynamic_title",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Generated by Django 4.2.5 on 2024-11-11 11:30
2+
3+
from django.db import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
dependencies = [
8+
("mod_app", "0025_increase_url_length_make_sources_m2m"),
9+
]
10+
11+
operations = [
12+
migrations.AlterModelOptions(
13+
name="feedback",
14+
options={
15+
"verbose_name": "Feedback on non-academic Activities",
16+
"verbose_name_plural": "Feedbacks on non-academic Activities",
17+
},
18+
),
19+
migrations.AlterModelOptions(
20+
name="projectnote",
21+
options={"verbose_name": "Research Framework"},
22+
),
23+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Generated by Django 4.2.5 on 2024-11-11 11:39
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
dependencies = [
8+
("mod_app", "0026_alter_feedback_options_alter_projectnote_options"),
9+
]
10+
11+
operations = [
12+
migrations.AddField(
13+
model_name="film",
14+
name="bfi_identifier",
15+
field=models.CharField(blank=True, max_length=7, null=True),
16+
),
17+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Generated by Django 4.2.5 on 2024-11-12 09:52
2+
3+
import ckeditor_uploader.fields
4+
from django.db import migrations, models
5+
6+
7+
class Migration(migrations.Migration):
8+
dependencies = [
9+
("mod_app", "0027_film_bfi_identifier"),
10+
]
11+
12+
operations = [
13+
migrations.CreateModel(
14+
name="VisualWrittenInfluences",
15+
fields=[
16+
(
17+
"id",
18+
models.BigAutoField(
19+
auto_created=True,
20+
primary_key=True,
21+
serialize=False,
22+
verbose_name="ID",
23+
),
24+
),
25+
("title", models.CharField(max_length=255)),
26+
(
27+
"content",
28+
ckeditor_uploader.fields.RichTextUploadingField(
29+
blank=True, help_text="Mentions are available here.", null=True
30+
),
31+
),
32+
(
33+
"bibliography",
34+
models.ManyToManyField(
35+
blank=True,
36+
help_text="This field updates on save, and some items may not be visible immediately",
37+
related_name="vwis",
38+
to="mod_app.bibliographyitem",
39+
),
40+
),
41+
],
42+
options={
43+
"verbose_name": "Visual and Written Influences",
44+
"verbose_name_plural": "Visual and Written Influences",
45+
},
46+
),
47+
migrations.AlterModelOptions(
48+
name="feedback",
49+
options={
50+
"verbose_name": "Feedback on non-academic Activities",
51+
"verbose_name_plural": "Feedback on non-academic Activities",
52+
},
53+
),
54+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# Generated by Django 4.2.5 on 2024-12-09 14:59
2+
3+
from django.db import migrations, models
4+
import django.db.models.deletion
5+
6+
7+
class Migration(migrations.Migration):
8+
dependencies = [
9+
("mod_app", "0028_visualwritteninfluences"),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name="drawing",
15+
name="film",
16+
field=models.ForeignKey(
17+
null=True,
18+
on_delete=django.db.models.deletion.SET_NULL,
19+
related_name="%(class)ss",
20+
to="mod_app.film",
21+
),
22+
),
23+
migrations.AlterField(
24+
model_name="otherlink",
25+
name="film",
26+
field=models.ForeignKey(
27+
null=True,
28+
on_delete=django.db.models.deletion.SET_NULL,
29+
related_name="%(class)ss",
30+
to="mod_app.film",
31+
),
32+
),
33+
migrations.AlterField(
34+
model_name="postcard",
35+
name="film",
36+
field=models.ForeignKey(
37+
null=True,
38+
on_delete=django.db.models.deletion.SET_NULL,
39+
related_name="%(class)ss",
40+
to="mod_app.film",
41+
),
42+
),
43+
migrations.AlterField(
44+
model_name="poster",
45+
name="film",
46+
field=models.ForeignKey(
47+
null=True,
48+
on_delete=django.db.models.deletion.SET_NULL,
49+
related_name="%(class)ss",
50+
to="mod_app.film",
51+
),
52+
),
53+
migrations.AlterField(
54+
model_name="pressbook",
55+
name="film",
56+
field=models.ForeignKey(
57+
null=True,
58+
on_delete=django.db.models.deletion.SET_NULL,
59+
related_name="%(class)ss",
60+
to="mod_app.film",
61+
),
62+
),
63+
migrations.AlterField(
64+
model_name="programme",
65+
name="film",
66+
field=models.ForeignKey(
67+
null=True,
68+
on_delete=django.db.models.deletion.SET_NULL,
69+
related_name="%(class)ss",
70+
to="mod_app.film",
71+
),
72+
),
73+
migrations.AlterField(
74+
model_name="publicity",
75+
name="film",
76+
field=models.ForeignKey(
77+
null=True,
78+
on_delete=django.db.models.deletion.SET_NULL,
79+
related_name="%(class)ss",
80+
to="mod_app.film",
81+
),
82+
),
83+
migrations.AlterField(
84+
model_name="script",
85+
name="film",
86+
field=models.ForeignKey(
87+
null=True,
88+
on_delete=django.db.models.deletion.SET_NULL,
89+
related_name="%(class)ss",
90+
to="mod_app.film",
91+
),
92+
),
93+
migrations.AlterField(
94+
model_name="still",
95+
name="film",
96+
field=models.ForeignKey(
97+
null=True,
98+
on_delete=django.db.models.deletion.SET_NULL,
99+
related_name="%(class)ss",
100+
to="mod_app.film",
101+
),
102+
),
103+
migrations.AlterField(
104+
model_name="video",
105+
name="film",
106+
field=models.ForeignKey(
107+
null=True,
108+
on_delete=django.db.models.deletion.SET_NULL,
109+
related_name="%(class)ss",
110+
to="mod_app.film",
111+
),
112+
),
113+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Generated by Django 4.2.5 on 2024-12-10 13:07
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
dependencies = [
8+
("mod_app", "0029_alter_drawing_film_alter_otherlink_film_and_more"),
9+
]
10+
11+
operations = [
12+
migrations.AddField(
13+
model_name="visualwritteninfluences",
14+
name="films",
15+
field=models.ManyToManyField(
16+
to="mod_app.Film", blank=True, related_name="vwis"
17+
),
18+
),
19+
]

0 commit comments

Comments
 (0)