-
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 #1645 from dchiller/i1628-source-printed
- Loading branch information
Showing
16 changed files
with
334 additions
and
227 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
22 changes: 22 additions & 0 deletions
22
django/cantusdb_project/main_app/management/commands/populate_source_completeness.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,22 @@ | ||
""" | ||
A temporary command to populate the source_completeness field in the Source model, | ||
based on the full_source field. This command will be removed once the source_completeness | ||
is initially populated. | ||
""" | ||
|
||
from django.core.management.base import BaseCommand | ||
from main_app.models import Source | ||
|
||
|
||
class Command(BaseCommand): | ||
def handle(self, *args, **options): | ||
sources = Source.objects.all() | ||
for source in sources: | ||
if source.full_source: | ||
source.source_completeness = ( | ||
source.SourceCompletenessChoices.FULL_SOURCE | ||
) | ||
else: | ||
source.source_completeness = source.SourceCompletenessChoices.FRAGMENT | ||
source.save() | ||
self.stdout.write(self.style.SUCCESS("Source completeness populated")) |
32 changes: 0 additions & 32 deletions
32
...go/cantusdb_project/main_app/migrations/0031_alter_source_holding_institution_and_more.py
This file was deleted.
Oops, something went wrong.
104 changes: 104 additions & 0 deletions
104
...antusdb_project/main_app/migrations/0031_source_name_source_production_method_and_more.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,104 @@ | ||
# Generated by Django 4.2.14 on 2024-10-02 17:01 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("main_app", "0030_institution_is_private_collection"), | ||
] | ||
|
||
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.AddField( | ||
model_name="source", | ||
name="production_method", | ||
field=models.IntegerField( | ||
choices=[(1, "Manuscript"), (2, "Printed")], | ||
default=1, | ||
verbose_name="Manuscript/Printed", | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="source", | ||
name="source_completeness", | ||
field=models.IntegerField( | ||
choices=[ | ||
(1, "Full source"), | ||
(2, "Fragment/Fragmented"), | ||
(3, "Reconstruction"), | ||
], | ||
default=1, | ||
verbose_name="Full Source/Fragment", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="institution", | ||
name="country", | ||
field=models.CharField(default="[No Country]", max_length=64), | ||
), | ||
migrations.AlterField( | ||
model_name="institution", | ||
name="name", | ||
field=models.CharField(default="[No Name]", max_length=255), | ||
), | ||
migrations.AlterField( | ||
model_name="source", | ||
name="shelfmark", | ||
field=models.CharField( | ||
default="[No Shelfmark]", | ||
help_text="Primary Cantus Database identifier for the source (e.g. library shelfmark, DACT ID, etc.)", | ||
max_length=255, | ||
), | ||
), | ||
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",), | ||
}, | ||
), | ||
] |
Oops, something went wrong.