-
Notifications
You must be signed in to change notification settings - Fork 6
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
Institution source changes #1629
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
329d8f4
Fixed: Add name field to source models
ahankinson 61a2d31
New: Add Source Identifier field
ahankinson fe72a2f
Fixed: Change "Private" to "Cantus"
ahankinson d0f7bf5
Fixed: Ensure the source identifiers are searchable in the admin UI
ahankinson b407110
Fixed: Adjust display fields
ahankinson 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
28 changes: 28 additions & 0 deletions
28
django/cantusdb_project/main_app/migrations/0032_source_name_alter_source_shelfmark.py
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,28 @@ | ||
# Generated by Django 4.2.14 on 2024-09-13 14:19 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("main_app", "0031_alter_source_holding_institution_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="source", | ||
name="name", | ||
field=models.CharField( | ||
blank=True, | ||
help_text="A colloquial or commonly-used name for the source", | ||
max_length=255, | ||
null=True, | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="source", | ||
name="shelfmark", | ||
field=models.CharField(max_length=255), | ||
), | ||
] |
53 changes: 53 additions & 0 deletions
53
django/cantusdb_project/main_app/migrations/0033_sourceidentifier.py
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,53 @@ | ||
# Generated by Django 4.2.14 on 2024-09-13 14:34 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("main_app", "0032_source_name_alter_source_shelfmark"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="SourceIdentifier", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("identifier", models.CharField(max_length=255)), | ||
( | ||
"type", | ||
models.IntegerField( | ||
choices=[ | ||
(1, "Other catalogues"), | ||
(2, "olim (Former shelfmark)"), | ||
(3, "Alternative names"), | ||
(4, "RISM Online"), | ||
] | ||
), | ||
), | ||
("note", models.TextField(blank=True, null=True)), | ||
( | ||
"source", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="identifiers", | ||
to="main_app.source", | ||
), | ||
), | ||
], | ||
options={ | ||
"verbose_name": "Source Identifier", | ||
"ordering": ("type",), | ||
}, | ||
), | ||
] |
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
33 changes: 33 additions & 0 deletions
33
django/cantusdb_project/main_app/models/source_identifier.py
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,33 @@ | ||
from django.db import models | ||
|
||
class SourceIdentifier(models.Model): | ||
class Meta: | ||
verbose_name = "Source Identifier" | ||
ordering = ('type',) | ||
|
||
OTHER = 1 | ||
OLIM = 2 | ||
ALTN = 3 | ||
RISM_ONLINE = 4 | ||
|
||
IDENTIFIER_TYPES = ( | ||
(OTHER, 'Other catalogues'), | ||
(OLIM, 'olim (Former shelfmark)'), | ||
(ALTN, 'Alternative names'), | ||
(RISM_ONLINE, "RISM Online") | ||
) | ||
|
||
identifier = models.CharField(max_length=255) | ||
type = models.IntegerField(choices=IDENTIFIER_TYPES) | ||
note = models.TextField(blank=True, null=True) | ||
source = models.ForeignKey("Source", | ||
related_name="identifiers", | ||
on_delete=models.CASCADE) | ||
|
||
def __str__(self): | ||
return f"{self.identifier}" | ||
|
||
@property | ||
def identifier_type(self): | ||
d = dict(self.IDENTIFIER_TYPES) | ||
return d[self.type] |
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.
If we aren't planning on reintroducing these fields in the admin form (I see currently they're read only in the admin page) then we can probably remove this comment.
Is the idea that eventually we will remove title and siglum data all together?
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.
Yeah, I guess I’m just hedging my bets here, waiting for someone to ask “but wait, where did the siglum field go” (and then another 128 emails follow ;-)