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

Feature/letter model updates #17

Merged
merged 7 commits into from
Feb 9, 2024
Merged

Conversation

lukavdplas
Copy link
Contributor

Expands the data model for letters (close #10)

  • Adds a name field to letters, which is required and unique, and used as the string representation. It will default to the current letter #3 string representation during the migration, though if you run this right after Feature/separate apps #16, this doesn't really matter. Note that this operation requires 3 (!) migration scripts, following django documentation on adding unique non-nullable fields.
  • Adds a category field to letters. Letter categories are a model by themselves, so researchers can add or remove categories as needed.
  • Adds date_active and date_written readonly fields to the admin interface. The values of these fields is based on the actions associated with the letter. They give the date range of, respectively, all actions involving the letters, and the "writing" actions involving the letter.
  • Adds addressees and senders fields to letters.

@lukavdplas lukavdplas linked an issue Feb 1, 2024 that may be closed by this pull request
Base automatically changed from feature/separate-apps to develop February 5, 2024 11:04
@XanderVertegaal XanderVertegaal self-requested a review February 9, 2024 12:17
Copy link
Contributor

@XanderVertegaal XanderVertegaal left a comment

Choose a reason for hiding this comment

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

All good changes! I think Hope and Robert will be pleased now letters will have names that are more insightful than simply 'letter #4' vel sim.

(I'm glad you added the link to the Django docs about the three migration scripts needed to insert a unique non-nullable field. It would have been quite confusing otherwise. ;))

return self._aggregate_dates(self.events.all())

@admin.display(
description="Date range in which this letter was written",
Copy link
Contributor

Choose a reason for hiding this comment

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

This is great! Good idea to add this!

@lukavdplas lukavdplas merged commit 6ee5254 into develop Feb 9, 2024
2 checks passed
@lukavdplas lukavdplas deleted the feature/letter-model-updates branch February 9, 2024 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Model changes for Letter
2 participants