-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
splitting vwis into vis and written #137
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -3,7 +3,7 @@ | |||||
from django.utils.html import format_html | ||||||
|
||||||
|
||||||
from mod_app.models import ProjectNote, Feedback, VisualWrittenInfluences | ||||||
from mod_app.models import ProjectNote, Feedback, VisualInfluences, WrittenInfluences | ||||||
from mod_app.utils.mixins import s3BrowserButtonMixin | ||||||
|
||||||
|
||||||
|
@@ -43,19 +43,49 @@ def safe_content(self, obj): | |||||
safe_content.short_description = "Content" | ||||||
|
||||||
|
||||||
class VWIInline(s3BrowserButtonMixin, admin.TabularInline): | ||||||
model = VisualWrittenInfluences.films.through | ||||||
class VisInline(s3BrowserButtonMixin, admin.TabularInline): | ||||||
model = VisualInfluences.films.through | ||||||
extra = 1 | ||||||
classes = [ | ||||||
"grp-collapse", | ||||||
"grp-open", | ||||||
] | ||||||
verbose_name = "Visual & Written Influences" | ||||||
verbose_name_plural = "Visual & Written Influences" | ||||||
verbose_name = "Visual Influences" | ||||||
verbose_name_plural = "Visual Influences" | ||||||
|
||||||
|
||||||
@admin.register(VisualWrittenInfluences) | ||||||
class VWIAdmin(s3BrowserButtonMixin, admin.ModelAdmin): | ||||||
class WritInline(s3BrowserButtonMixin, admin.TabularInline): | ||||||
model = WrittenInfluences.films.through | ||||||
extra = 1 | ||||||
classes = [ | ||||||
"grp-collapse", | ||||||
"grp-open", | ||||||
] | ||||||
verbose_name = "Written Influences" | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
As above. Unless this is deliberate? |
||||||
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",) | ||||||
|
||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
# Generated by Django 4.2.5 on 2025-01-08 13:14 | ||
|
||
import ckeditor_uploader.fields | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("mod_app", "0030_add_films_to_vwi"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="VisualInfluences", | ||
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="visual_influences", | ||
to="mod_app.bibliographyitem", | ||
), | ||
), | ||
( | ||
"films", | ||
models.ManyToManyField( | ||
blank=True, related_name="visual_influences", to="mod_app.film" | ||
), | ||
), | ||
], | ||
options={ | ||
"verbose_name": "Visual Influence", | ||
"verbose_name_plural": "Visual Influences", | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name="WrittenInfluences", | ||
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="written_influences", | ||
to="mod_app.bibliographyitem", | ||
), | ||
), | ||
( | ||
"films", | ||
models.ManyToManyField( | ||
blank=True, related_name="written_influences", to="mod_app.film" | ||
), | ||
), | ||
], | ||
options={ | ||
"verbose_name": "Written Influence", | ||
"verbose_name_plural": "Written Influences", | ||
}, | ||
), | ||
migrations.DeleteModel( | ||
name="VisualWrittenInfluences", | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the model you've defined verbose name as "Visual Influence" rather than "Visual Influences".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, deliberate, since they're separate now I thought they might end up making new entries for each
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
worst case I'm wrong and we change it back