-
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
Add feedback model #111
Add feedback model #111
Changes from 4 commits
c5bb499
cf6935e
daa6a0d
434aaa2
7cc1ee7
1b990b1
0881108
f7f12de
ac70d23
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,90 @@ | ||||||||||||||||||||||||||||||||||||
# Generated by Django 4.2.5 on 2024-06-27 13:55 | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
import ckeditor.fields | ||||||||||||||||||||||||||||||||||||
import ckeditor_uploader.fields | ||||||||||||||||||||||||||||||||||||
from django.db import migrations, models | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
class Migration(migrations.Migration): | ||||||||||||||||||||||||||||||||||||
dependencies = [ | ||||||||||||||||||||||||||||||||||||
("mod_app", "0022_bibliographyitem_annotation"), | ||||||||||||||||||||||||||||||||||||
] | ||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
operations = [ | ||||||||||||||||||||||||||||||||||||
migrations.AlterField( | ||||||||||||||||||||||||||||||||||||
model_name="bibliographyitem", | ||||||||||||||||||||||||||||||||||||
name="full_citation", | ||||||||||||||||||||||||||||||||||||
field=ckeditor.fields.RichTextField( | ||||||||||||||||||||||||||||||||||||
help_text="Please use Harvard reference list style. Examples: Author surname, initial. (year). 'Title of article/book/website/photograph'. Available at: URL or DOI where applicable (date accessed). Please note that the website or photo title should be italicised. For more detailed information and examples visit: https://www5.open.ac.uk/library/referencing-and-plagiarism/quick-guide-to-harvard-referencing-cite-them-right", | ||||||||||||||||||||||||||||||||||||
null=True, | ||||||||||||||||||||||||||||||||||||
), | ||||||||||||||||||||||||||||||||||||
), | ||||||||||||||||||||||||||||||||||||
migrations.AlterField( | ||||||||||||||||||||||||||||||||||||
model_name="bibliographyitem", | ||||||||||||||||||||||||||||||||||||
name="short_citation", | ||||||||||||||||||||||||||||||||||||
field=models.CharField( | ||||||||||||||||||||||||||||||||||||
help_text="Please use Harvard in-text citation style. Examples: (Author surname, year), or in the case of up to 3 authors: (Author 1 surname, Author 2 surname, Author 3 surname, year), or in the case or more than 3 authors: (Author 1 surname, et al., year) ", | ||||||||||||||||||||||||||||||||||||
max_length=200, | ||||||||||||||||||||||||||||||||||||
null=True, | ||||||||||||||||||||||||||||||||||||
), | ||||||||||||||||||||||||||||||||||||
), | ||||||||||||||||||||||||||||||||||||
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. these look the same as
However, the previous migrations include two spaces after full stops whereas the new migrations have a single space 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. Ah we might need to do something with linting then? We have some set up but maybe they need to be more strict 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. We could add a check in CI to make sure there are no missing migrations: python manage.py makemigrations --check --dry-run --no-input which I think would fail if there are any migrations missing. If this runs on every PR then it should help avoid merging anything with missing migrations |
||||||||||||||||||||||||||||||||||||
migrations.AlterField( | ||||||||||||||||||||||||||||||||||||
model_name="film", | ||||||||||||||||||||||||||||||||||||
name="format_type", | ||||||||||||||||||||||||||||||||||||
field=models.CharField( | ||||||||||||||||||||||||||||||||||||
choices=[ | ||||||||||||||||||||||||||||||||||||
("16", "16 mm"), | ||||||||||||||||||||||||||||||||||||
("70", "70 mm"), | ||||||||||||||||||||||||||||||||||||
("other", "Other"), | ||||||||||||||||||||||||||||||||||||
("9.5", "9.5 mm"), | ||||||||||||||||||||||||||||||||||||
("35", "35 mm"), | ||||||||||||||||||||||||||||||||||||
], | ||||||||||||||||||||||||||||||||||||
default="35", | ||||||||||||||||||||||||||||||||||||
max_length=5, | ||||||||||||||||||||||||||||||||||||
verbose_name="format", | ||||||||||||||||||||||||||||||||||||
), | ||||||||||||||||||||||||||||||||||||
), | ||||||||||||||||||||||||||||||||||||
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. this field changes every time |
||||||||||||||||||||||||||||||||||||
migrations.AlterField( | ||||||||||||||||||||||||||||||||||||
model_name="projectnote", | ||||||||||||||||||||||||||||||||||||
name="bibliography", | ||||||||||||||||||||||||||||||||||||
field=models.ManyToManyField( | ||||||||||||||||||||||||||||||||||||
blank=True, | ||||||||||||||||||||||||||||||||||||
help_text="This field updates on save, and some items may not be visible immediately", | ||||||||||||||||||||||||||||||||||||
related_name="project_notes", | ||||||||||||||||||||||||||||||||||||
to="mod_app.bibliographyitem", | ||||||||||||||||||||||||||||||||||||
), | ||||||||||||||||||||||||||||||||||||
), | ||||||||||||||||||||||||||||||||||||
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. this looks similar to the migration from when the model was created: museum_of_dreams/mod_app/migrations/0021_add_project_notes_model.py Lines 33 to 41 in 90db50e
but the related_name has changed from project_note to project_notes
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. Ah, the model definition and the migration differ, I've pushed a fix to change the version on the model since that's more straightforward than fixing previous migrations |
||||||||||||||||||||||||||||||||||||
migrations.CreateModel( | ||||||||||||||||||||||||||||||||||||
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. Everything before this in the operations should probably be deleted since they should've been covered in earlier migrations, unsure why it keeps doing this. |
||||||||||||||||||||||||||||||||||||
name="Feedback", | ||||||||||||||||||||||||||||||||||||
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="feedback", | ||||||||||||||||||||||||||||||||||||
to="mod_app.bibliographyitem", | ||||||||||||||||||||||||||||||||||||
), | ||||||||||||||||||||||||||||||||||||
), | ||||||||||||||||||||||||||||||||||||
], | ||||||||||||||||||||||||||||||||||||
options={ | ||||||||||||||||||||||||||||||||||||
"verbose_name": "Feedback", | ||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||
), | ||||||||||||||||||||||||||||||||||||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from ckeditor_uploader.fields import RichTextUploadingField | ||
from django.db import models | ||
|
||
from .bibliography_model import BibliographyItem | ||
from ..utils.extract_citations import update_bibliography | ||
|
||
|
||
class Feedback(models.Model): | ||
class Meta: | ||
verbose_name = "Feedback" | ||
|
||
def __str__(self): | ||
return self.title | ||
|
||
title = models.CharField(max_length=255, null=False) | ||
|
||
content = RichTextUploadingField( | ||
null=True, | ||
blank=True, | ||
help_text="Mentions are available here.", | ||
) | ||
|
||
bibliography = models.ManyToManyField( | ||
BibliographyItem, | ||
blank=True, | ||
related_name="feedback", | ||
help_text="This field updates on save, and some items may not be visible immediately", | ||
) | ||
|
||
def save(self, *args, **kwargs): | ||
super().save(*args, **kwargs) | ||
|
||
update_bibliography(self, self.content) |
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.
this should be under the "Extras" section. It also doesn't show up since we do actually have to register it in the admin (I was wrong)
You can add it to
admin/note_admin.py
and use theProjectNoteAdmin
as a templateThere 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.
oh I see, thanks!