Skip to content

Commit

Permalink
Merge pull request #136 from UCL-ARC/development
Browse files Browse the repository at this point in the history
Updating Production
  • Loading branch information
acholyn authored Jan 14, 2025
2 parents 25b3e71 + 2fc0d6b commit 46a72dc
Show file tree
Hide file tree
Showing 26 changed files with 646 additions and 10 deletions.
2 changes: 2 additions & 0 deletions dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ def init_with_context(self, context):
"mod_app.models.support_models.OtherLink",
"mod_app.models.support_models.Tag",
"mod_app.models.feedback_model.Feedback",
"mod_app.models.visual_written_influences_model.VisualInfluences",
"mod_app.models.visual_written_influences_model.WrittenInfluences",
),
),
],
Expand Down
28 changes: 27 additions & 1 deletion mod_app/admin/film_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
StillInline,
VideoInline,
)
from mod_app.admin.note_admin import VisInline, WritInline
from mod_app.utils.mixins import EmailMixin

from ..models import Analysis, TeachingResources, Film
Expand Down Expand Up @@ -55,6 +56,7 @@ class Media:

autocomplete_fields = ["genre"]
search_fields = [
"bfi_identifier",
"title",
"alt_titles",
"production_company",
Expand All @@ -70,6 +72,8 @@ class Media:
inlines = [
FilmAnalysisInline,
TRInline,
VisInline,
WritInline,
SourceInline,
OtherLinkInline,
VideoInline,
Expand All @@ -84,6 +88,7 @@ class Media:
]
list_display = [
"title",
"bfi_identifier",
"safe_temporary_images",
"preview_video",
"safe_alt_titles",
Expand Down Expand Up @@ -155,7 +160,10 @@ def preview_video(self, obj):
"fields": (
"title",
"alt_titles",
"release_date",
(
"bfi_identifier",
"release_date",
),
("production_country", "production_company"),
"synopsis",
("cast", "crew"),
Expand Down Expand Up @@ -203,6 +211,24 @@ def preview_video(self, obj):
None,
{"classes": ("placeholder TeachingResources_films-group",), "fields": ()},
),
(
"Visual & Written Influences",
{"fields": []},
),
(
None,
{
"classes": ("placeholder VisualInfluences_films-group",),
"fields": (),
},
),
(
None,
{
"classes": ("placeholder WrittenInfluences_films-group",),
"fields": (),
},
),
(
"Comments and List Images",
{
Expand Down
63 changes: 62 additions & 1 deletion mod_app/admin/note_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
from django.utils.html import format_html


from mod_app.models import ProjectNote, Feedback
from mod_app.models import ProjectNote, Feedback, VisualInfluences, WrittenInfluences
from mod_app.utils.mixins import s3BrowserButtonMixin


@admin.register(ProjectNote)
Expand Down Expand Up @@ -40,3 +41,63 @@ def safe_content(self, obj):

safe_content.allow_tags = True
safe_content.short_description = "Content"


class VisInline(s3BrowserButtonMixin, admin.TabularInline):
model = VisualInfluences.films.through
extra = 1
classes = [
"grp-collapse",
"grp-open",
]
verbose_name = "Visual Influences"
verbose_name_plural = "Visual Influences"


class WritInline(s3BrowserButtonMixin, admin.TabularInline):
model = WrittenInfluences.films.through
extra = 1
classes = [
"grp-collapse",
"grp-open",
]
verbose_name = "Written Influences"
verbose_name_plural = "Written Influences"


@admin.register(VisualInfluences)
class VisualInfluencesAdmin(s3BrowserButtonMixin, admin.ModelAdmin):
class Media:
js = ("admin/js/mentionsPluginConfig.js",)

search_fields = ["title"]
list_display = ["title", "safe_content"]
readonly_fields = ("bibliography",)
filter_horizontal = ("films",)

def safe_content(self, obj):
truncated_content = truncatechars_html(obj.content, 200)
modified_content = truncated_content.replace("{", "(").replace("}", ")")
return format_html(modified_content)

safe_content.allow_tags = True
safe_content.short_description = "Content"


@admin.register(WrittenInfluences)
class WrittenInfluencesAdmin(s3BrowserButtonMixin, admin.ModelAdmin):
class Media:
js = ("admin/js/mentionsPluginConfig.js",)

search_fields = ["title"]
list_display = ["title", "safe_content"]
readonly_fields = ("bibliography",)
filter_horizontal = ("films",)

def safe_content(self, obj):
truncated_content = truncatechars_html(obj.content, 200)
modified_content = truncated_content.replace("{", "(").replace("}", ")")
return format_html(modified_content)

safe_content.allow_tags = True
safe_content.short_description = "Content"
2 changes: 2 additions & 0 deletions mod_app/admin/teaching_analysis_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ class Media:
"list_tags",
"safe_content",
]
filter_horizontal = ("films",)

def dynamic_title(self, obj):
return obj.__str__()
Expand Down Expand Up @@ -116,6 +117,7 @@ class Media:
autocomplete_fields = ["films", "topics", "tags", "clips"]
readonly_fields = ("safe_bibliography",)
exclude = ["bibliography"]
filter_horizontal = ("films",)

list_display = [
"dynamic_title",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 4.2.5 on 2024-11-11 11:30

from django.db import migrations


class Migration(migrations.Migration):
dependencies = [
("mod_app", "0025_increase_url_length_make_sources_m2m"),
]

operations = [
migrations.AlterModelOptions(
name="feedback",
options={
"verbose_name": "Feedback on non-academic Activities",
"verbose_name_plural": "Feedbacks on non-academic Activities",
},
),
migrations.AlterModelOptions(
name="projectnote",
options={"verbose_name": "Research Framework"},
),
]
17 changes: 17 additions & 0 deletions mod_app/migrations/0027_film_bfi_identifier.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.2.5 on 2024-11-11 11:39

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("mod_app", "0026_alter_feedback_options_alter_projectnote_options"),
]

operations = [
migrations.AddField(
model_name="film",
name="bfi_identifier",
field=models.CharField(blank=True, max_length=7, null=True),
),
]
54 changes: 54 additions & 0 deletions mod_app/migrations/0028_visualwritteninfluences.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Generated by Django 4.2.5 on 2024-11-12 09:52

import ckeditor_uploader.fields
from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("mod_app", "0027_film_bfi_identifier"),
]

operations = [
migrations.CreateModel(
name="VisualWrittenInfluences",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("title", models.CharField(max_length=255)),
(
"content",
ckeditor_uploader.fields.RichTextUploadingField(
blank=True, help_text="Mentions are available here.", null=True
),
),
(
"bibliography",
models.ManyToManyField(
blank=True,
help_text="This field updates on save, and some items may not be visible immediately",
related_name="vwis",
to="mod_app.bibliographyitem",
),
),
],
options={
"verbose_name": "Visual and Written Influences",
"verbose_name_plural": "Visual and Written Influences",
},
),
migrations.AlterModelOptions(
name="feedback",
options={
"verbose_name": "Feedback on non-academic Activities",
"verbose_name_plural": "Feedback on non-academic Activities",
},
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# Generated by Django 4.2.5 on 2024-12-09 14:59

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):
dependencies = [
("mod_app", "0028_visualwritteninfluences"),
]

operations = [
migrations.AlterField(
model_name="drawing",
name="film",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="%(class)ss",
to="mod_app.film",
),
),
migrations.AlterField(
model_name="otherlink",
name="film",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="%(class)ss",
to="mod_app.film",
),
),
migrations.AlterField(
model_name="postcard",
name="film",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="%(class)ss",
to="mod_app.film",
),
),
migrations.AlterField(
model_name="poster",
name="film",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="%(class)ss",
to="mod_app.film",
),
),
migrations.AlterField(
model_name="pressbook",
name="film",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="%(class)ss",
to="mod_app.film",
),
),
migrations.AlterField(
model_name="programme",
name="film",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="%(class)ss",
to="mod_app.film",
),
),
migrations.AlterField(
model_name="publicity",
name="film",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="%(class)ss",
to="mod_app.film",
),
),
migrations.AlterField(
model_name="script",
name="film",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="%(class)ss",
to="mod_app.film",
),
),
migrations.AlterField(
model_name="still",
name="film",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="%(class)ss",
to="mod_app.film",
),
),
migrations.AlterField(
model_name="video",
name="film",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="%(class)ss",
to="mod_app.film",
),
),
]
19 changes: 19 additions & 0 deletions mod_app/migrations/0030_add_films_to_vwi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 4.2.5 on 2024-12-10 13:07

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("mod_app", "0029_alter_drawing_film_alter_otherlink_film_and_more"),
]

operations = [
migrations.AddField(
model_name="visualwritteninfluences",
name="films",
field=models.ManyToManyField(
to="mod_app.Film", blank=True, related_name="vwis"
),
),
]
Loading

0 comments on commit 46a72dc

Please sign in to comment.