Skip to content

Commit 754a47f

Browse files
authored
Merge pull request #130 from UCL-ARC/amanda/small-tweaks
small updates following async discussion
2 parents 20d93c0 + 4d85816 commit 754a47f

11 files changed

+157
-3
lines changed

dashboard.py

+1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ 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.VisualWrittenInfluences",
8990
),
9091
),
9192
],

mod_app/admin/note_admin.py

+19-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
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, VisualWrittenInfluences
77

88

99
@admin.register(ProjectNote)
@@ -40,3 +40,21 @@ def safe_content(self, obj):
4040

4141
safe_content.allow_tags = True
4242
safe_content.short_description = "Content"
43+
44+
45+
@admin.register(VisualWrittenInfluences)
46+
class VWIAdmin(admin.ModelAdmin):
47+
class Media:
48+
js = ("admin/js/mentionsPluginConfig.js",)
49+
50+
search_fields = ["title"]
51+
list_display = ["title", "safe_content"]
52+
readonly_fields = ("bibliography",)
53+
54+
def safe_content(self, obj):
55+
truncated_content = truncatechars_html(obj.content, 200)
56+
modified_content = truncated_content.replace("{", "(").replace("}", ")")
57+
return format_html(modified_content)
58+
59+
safe_content.allow_tags = True
60+
safe_content.short_description = "Content"
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+
]

mod_app/models/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
Analysis,
2424
TeachingResources,
2525
)
26+
from .visual_written_influences_model import VisualWrittenInfluences
2627

2728
__all__ = [
2829
"Analysis",
@@ -46,4 +47,5 @@
4647
"Video",
4748
"ProjectNote",
4849
"Feedback",
50+
"VisualWrittenInfluences",
4951
]

mod_app/models/feedback_model.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77

88
class Feedback(models.Model):
99
class Meta:
10-
verbose_name = "Feedback"
10+
verbose_name = "Feedback on non-academic Activities"
11+
verbose_name_plural = "Feedback on non-academic Activities"
1112

1213
def __str__(self):
1314
return self.title

mod_app/models/film_model.py

+2
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ def get_absolute_url(self):
7272
max_length=100, blank=True, null=True
7373
) # can use choices if preset
7474

75+
bfi_identifier = models.CharField(max_length=7, blank=True, null=True)
76+
7577
cast = models.TextField(
7678
blank=True,
7779
null=True,

mod_app/models/project_note_model.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class ProjectNote(models.Model):
99
class Meta:
10-
verbose_name = "Introduction"
10+
verbose_name = "Research Framework"
1111

1212
def __str__(self):
1313
return self.title
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
from ckeditor_uploader.fields import RichTextUploadingField
2+
from django.db import models
3+
4+
from mod_app.models import BibliographyItem
5+
from ..utils.extract_citations import update_bibliography
6+
7+
8+
class VisualWrittenInfluences(models.Model):
9+
class Meta:
10+
verbose_name = "Visual and Written Influences"
11+
verbose_name_plural = "Visual and Written Influences"
12+
13+
def __str__(self):
14+
return self.title
15+
16+
title = models.CharField(max_length=255, null=False)
17+
18+
content = RichTextUploadingField(
19+
null=True,
20+
blank=True,
21+
help_text="Mentions are available here.",
22+
)
23+
24+
bibliography = models.ManyToManyField(
25+
BibliographyItem,
26+
blank=True,
27+
related_name="vwis",
28+
help_text="This field updates on save, and some items may not be visible immediately",
29+
)
30+
31+
def save(self, *args, **kwargs):
32+
super().save(*args, **kwargs)
33+
34+
update_bibliography(self, [self.content])

mod_app/templates/base.html

+2
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ <h1 class="title__text--construction">{% trans "NOTICE: This site is currently u
117117

118118
Further information on the project and its activities can be found, for now, at:<a href=https://www.ucl.ac.uk/classics/research/research-projects/museum-dream-worlds> Museum of Dreamworlds at UCL</a>
119119
</p>
120+
<p>If you'd like to get in touch, send us an email at <a href="mailto:[email protected]">[email protected]</a>
121+
</p>
120122
</div>
121123
{% endif %}
122124
{% endblock %}

0 commit comments

Comments
 (0)