-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1629 from DDMAL/institution-source-changes
Institution source changes
- Loading branch information
Showing
9 changed files
with
157 additions
and
16 deletions.
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