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

Gazette volume number and resource #1836

Merged
merged 5 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions peachjam/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
from peachjam.resources import (
ArticleResource,
AttorneyResource,
GazetteResource,
GenericDocumentResource,
JudgmentResource,
UserResource,
Expand Down Expand Up @@ -1057,8 +1058,18 @@ class AuthorAdmin(admin.ModelAdmin):


@admin.register(Gazette)
class GazetteAdmin(DocumentAdmin):
pass
class GazetteAdmin(ImportExportMixin, DocumentAdmin):
fieldsets = copy.deepcopy(DocumentAdmin.fieldsets)
fieldsets[0][1]["fields"].extend(
[
"volume_number",
"sub_publication",
"supplement",
"supplement_number",
"publication",
]
)
Comment on lines +1063 to +1071
Copy link
Contributor Author

Choose a reason for hiding this comment

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

added these to the admin as well

resource_class = GazetteResource


@admin.register(Book)
Expand Down
20 changes: 20 additions & 0 deletions peachjam/migrations/0138_gazette_volume_number.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 3.2.21 on 2024-06-04 10:21

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("peachjam", "0137_registry_court"),
]

operations = [
migrations.AddField(
model_name="gazette",
name="volume_number",
field=models.CharField(
blank=True, max_length=512, null=True, verbose_name="volume number"
),
),
]
3 changes: 3 additions & 0 deletions peachjam/models/gazette.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ class Gazette(CoreDocument):
key = models.CharField(
_("key"), max_length=512, null=True, blank=True, db_index=True
)
volume_number = models.CharField(
_("volume number"), max_length=512, null=True, blank=True
)

class Meta(CoreDocument.Meta):
verbose_name = _("gazette")
Expand Down
6 changes: 6 additions & 0 deletions peachjam/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
CourtRegistry,
DocumentNature,
DocumentTopic,
Gazette,
GenericDocument,
Judge,
Judgment,
Expand Down Expand Up @@ -675,6 +676,11 @@ class Meta:
exclude = ("slug",)


class GazetteResource(BaseDocumentResource):
class Meta(BaseDocumentResource.Meta):
model = Gazette


class UserResource(resources.ModelResource):
groups = fields.Field(
column_name="groups",
Expand Down
2 changes: 1 addition & 1 deletion peachjam/templates/peachjam/gazette_year.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ <h2 class="mt-3" id="{{ forloop.counter }}">{{ month }} {{ year }}</h2>
<a href="{{ gazette.get_absolute_url }}">{{ gazette.title }}</a>
</td>
<td>
<span class="d-none d-lg-block">{{ gazette.sub_publication|default:"" }}</span>
<span class="d-none d-lg-block">{{ gazette.sub_publication|default:"" }} {{ gazette.volume_number|default:"" }}</span>
</td>
<td>
<span class="d-none d-lg-block">{{ gazette.frbr_uri_number }}</span>
Expand Down
Loading