Skip to content
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

Merged
merged 9 commits into from
Jul 1, 2024
Merged

Add feedback model #111

merged 9 commits into from
Jul 1, 2024

Conversation

p-j-smith
Copy link
Collaborator

@p-j-smith p-j-smith commented Jun 27, 2024

Resolves #107

  • added a Feedback model
  • added migrations for the model. There seem to be some migrations unrelated to the new model for some reason
  • added Feedback model to the admin view

Migrations for 'mod_app':
  mod_app/migrations/0023_alter_bibliographyitem_full_citation_and_more.py
    - Alter field full_citation on bibliographyitem
    - Alter field short_citation on bibliographyitem
    - Alter field format_type on film
    - Alter field bibliography on projectnote
    - Create model Feedback
@p-j-smith p-j-smith requested a review from acholyn June 27, 2024 14:01
Copy link
Collaborator Author

@p-j-smith p-j-smith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought there were some unnecessary migrations but looking more closely they all seem to make sense (except the changes to the Film model but that's related to #112 )

Comment on lines 14 to 30
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,
),
),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these look the same as

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,
),
),

However, the previous migrations include two spaces after full stops whereas the new migrations have a single space

Copy link
Collaborator

Choose a reason for hiding this comment

The 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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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

Comment on lines 47 to 56
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",
),
),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks similar to the migration from when the model was created:

(
"bibliography",
models.ManyToManyField(
blank=True,
help_text="This field updates on save, and some items may not be visible immediately",
related_name="project_note",
to="mod_app.bibliographyitem",
),
),

but the related_name has changed from project_note to project_notes

Copy link
Collaborator

Choose a reason for hiding this comment

The 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

Comment on lines 31 to 46
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",
),
),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this field changes every time python manage.py makemigrations is ran. I've opened an issue (#112) and will submit a PR to fix it once this is merged

to="mod_app.bibliographyitem",
),
),
migrations.CreateModel(
Copy link
Collaborator

Choose a reason for hiding this comment

The 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.
Should probably rename the file to something like "0023_add_feedback_model.py"
Otherwise all looks good

Comment on lines 14 to 30
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,
),
),
Copy link
Collaborator

Choose a reason for hiding this comment

The 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

Comment on lines 47 to 56
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",
),
),
Copy link
Collaborator

Choose a reason for hiding this comment

The 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

dashboard.py Outdated
@@ -53,6 +53,7 @@ def init_with_context(self, context):
"mod_app.models.teaching_analysis_models.*",
"mod_app.models.bibliography_model.*",
"mod_app.models.project_note_model.ProjectNote",
"mod_app.models.feedback_model.Feedback",
Copy link
Collaborator

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 the ProjectNoteAdmin as a template

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh I see, thanks!

@p-j-smith p-j-smith merged commit 09226af into development Jul 1, 2024
3 checks passed
@acholyn acholyn deleted the feat/feedback-model branch July 2, 2024 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Feedback model
2 participants