-
Notifications
You must be signed in to change notification settings - Fork 0
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 #49 from CentreForDigitalHumanities/feature/source…
…-description-split-2-contd source description split (gifts, letters)
- Loading branch information
Showing
14 changed files
with
625 additions
and
214 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
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
21 changes: 21 additions & 0 deletions
21
backend/event/migrations/0011_remove_letteraction_gifts_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,21 @@ | ||
# Generated by Django 4.2.7 on 2024-04-10 12:52 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('event', '0010_remove_letteraction_actors_delete_role'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='letteraction', | ||
name='gifts', | ||
), | ||
migrations.RemoveField( | ||
model_name='letteraction', | ||
name='letters', | ||
), | ||
] |
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
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 |
---|---|---|
@@ -1,53 +1,92 @@ | ||
from django.contrib import admin | ||
from . import models | ||
from core import admin as core_admin | ||
|
||
|
||
@admin.register(models.GiftCategory) | ||
class GiftCategoryAdmin(admin.ModelAdmin): | ||
pass | ||
|
||
|
||
class GiftDescriptionCategoryAdmin(admin.StackedInline): | ||
model = models.GiftDescriptionCategory | ||
fields = ["category"] + core_admin.description_field_fields | ||
extra = 0 | ||
verbose_name = "category" | ||
verbose_name_plural = "categories" | ||
|
||
|
||
class GiftDescriptionSenderAdmin(admin.StackedInline): | ||
model = models.GiftDescriptionSender | ||
fields = ["agent"] + core_admin.description_field_fields | ||
extra = 0 | ||
verbose_name = "sender" | ||
|
||
|
||
class GiftDescriptionAddresseeAdmin(admin.StackedInline): | ||
model = models.GiftDescriptionAddressee | ||
fields = ["agent"] + core_admin.description_field_fields | ||
extra = 0 | ||
verbose_name = "addressee" | ||
|
||
|
||
@admin.register(models.GiftDescription) | ||
class GiftDescriptionAdmin(core_admin.EntityDescriptionAdmin, admin.ModelAdmin): | ||
inlines = [ | ||
GiftDescriptionCategoryAdmin, | ||
GiftDescriptionSenderAdmin, | ||
GiftDescriptionAddresseeAdmin, | ||
] | ||
|
||
|
||
@admin.register(models.Category) | ||
class CategoryAdmin(admin.ModelAdmin): | ||
fields = ["label", "description"] | ||
|
||
|
||
class LetterMaterialAdmin(admin.StackedInline): | ||
model = models.LetterMaterial | ||
fields = ["surface", "certainty", "note"] | ||
|
||
|
||
class LetterCategoryAdmin(admin.StackedInline): | ||
model = models.LetterCategory | ||
fields = ["letter", "category", "certainty", "note"] | ||
class LetterDescriptionCategoryAdmin(admin.StackedInline): | ||
model = models.LetterDescriptionCategory | ||
fields = ["category"] + core_admin.description_field_fields | ||
extra = 0 | ||
verbose_name = "category" | ||
verbose_name_plural = "categories" | ||
|
||
|
||
# class LetterSenderAdmin(admin.StackedInline): | ||
# model = models.LetterSenders | ||
# fields = ["letter", "senders", "certainty", "note"] | ||
# filter_horizontal = ["senders"] | ||
class LetterDescriptionSenderAdmin(admin.StackedInline): | ||
model = models.LetterDescriptionSender | ||
fields = ["agent"] + core_admin.description_field_fields | ||
extra = 0 | ||
verbose_name = "sender" | ||
|
||
|
||
# class LetterAddresseesAdmin(admin.StackedInline): | ||
# model = models.LetterAddressees | ||
# fields = ["letter", "addressees", "certainty", "note"] | ||
# filter_horizontal = ["addressees"] | ||
class LetterDescriptionAddresseeAdmin(admin.StackedInline): | ||
model = models.LetterDescriptionAddressee | ||
fields = ["agent"] + core_admin.description_field_fields | ||
extra = 0 | ||
verbose_name = "addressee" | ||
|
||
|
||
@admin.register(models.Letter) | ||
class LetterAdmin(admin.ModelAdmin): | ||
readonly_fields = ["date_active", "date_written"] | ||
@admin.register(models.LetterDescription) | ||
class LetterDescriptionAdmin(core_admin.EntityDescriptionAdmin, admin.ModelAdmin): | ||
inlines = [ | ||
LetterCategoryAdmin, | ||
# LetterMaterialAdmin, | ||
# LetterSenderAdmin, | ||
# LetterAddresseesAdmin, | ||
LetterDescriptionCategoryAdmin, | ||
LetterDescriptionSenderAdmin, | ||
LetterDescriptionAddresseeAdmin, | ||
] | ||
|
||
|
||
class GiftLetterActionInline(admin.StackedInline): | ||
model = models.Gift.letter_actions.through | ||
class PreservedLetterRoleAdmin(admin.StackedInline): | ||
model = models.PreservedLetterRole | ||
fields = ["letter", "person"] + core_admin.field_fields | ||
extra = 0 | ||
verbose_name_plural = "letter actions" | ||
verbose_name = "relationship between a gift and an associated letter action" | ||
verbose_name = "involved historical person" | ||
verbose_name_plural = "involved historical persons" | ||
|
||
|
||
@admin.register(models.Gift) | ||
class GiftAdmin(admin.ModelAdmin): | ||
fields = ["name", "description", "material"] | ||
filter_horizontal = ["letter_actions"] | ||
@admin.register(models.PreservedLetter) | ||
class PreservedLetterAdmin(admin.ModelAdmin): | ||
list_display = ["name", "description"] | ||
fields = ["name", "description"] | ||
inlines = [ | ||
PreservedLetterRoleAdmin, | ||
] |
Oops, something went wrong.