Skip to content

Commit

Permalink
EREGCSC-2511-add-columns-admin-panel (#1188)
Browse files Browse the repository at this point in the history
* EREGCSC-2511-add-columns-admin-panel

* initial load
  • Loading branch information
peggles2 authored Mar 1, 2024
1 parent 273046f commit 66a2efd
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 8 deletions.
13 changes: 7 additions & 6 deletions solution/backend/file_manager/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,15 @@ class Meta:
@admin.register(UploadedFile)
class UploadedFileAdmin(BaseAdmin):
form = UploadAdminForm
list_display = ("document_name", "index_populated")
list_display = ("date", "document_name", "category", "updated_at", "index_populated")
search_fields = ["document_name"]
ordering = ("document_name",)
ordering = ("date", "document_name", "category", "updated_at",)
filter_horizontal = ("locations", "subjects")
readonly_fields = ('download_file', 'file_name', 'get_content', 'index_populated')
fields = ("file_name", "file_path", "document_name", 'date', 'summary',
'document_type', 'subjects', 'locations', 'internal_notes',
'index_populated', 'get_content', 'download_file', 'category',)
readonly_fields = ("download_file", "file_name", "get_content", "updated_at", "index_populated")
fields = ("file_name", "file_path", "document_name", "date", "summary",
"updated_at", "document_type", "subjects", "locations", "internal_notes",
"index_populated", "get_content", "download_file", "category",)

manytomany_lookups = {
"locations": lambda: AbstractLocation.objects.all().select_subclasses(),
"subjects": lambda: Subject.objects.all()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.24 on 2024-02-27 14:17

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('file_manager', '0015_auto_20231207_1615'),
]

operations = [
migrations.AddField(
model_name='uploadedfile',
name='updated_at',
field=models.DateTimeField(auto_now=True),
),
]
1 change: 1 addition & 0 deletions solution/backend/file_manager/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class UploadedFile(models.Model):
internal_notes = models.TextField(null=True, blank=True)
subjects = models.ManyToManyField(Subject, blank=True, related_name="uploads")
document_type = models.ForeignKey(DocumentType, blank=True, null=True, related_name="uploads", on_delete=models.SET_NULL)
updated_at = models.DateTimeField(auto_now=True)
category = models.ForeignKey(
AbstractRepoCategory, null=True, blank=True, on_delete=models.SET_NULL, related_name="uploads"
)
Expand Down
1 change: 1 addition & 0 deletions solution/backend/file_manager/serializers/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@


class UploadedFileSerializer(DetailsSerializer, serializers.Serializer, ):
updated_at = serializers.CharField()
document_name = serializers.CharField()
file_name = serializers.CharField()
date = serializers.DateField()
Expand Down
4 changes: 2 additions & 2 deletions solution/backend/resources/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ class SupplementalContentAdmin(AbstractResourceAdmin):
change_list_template = "admin/import_resources_button.html"
form = SupContentForm
readonly_fields = ("get_content", "index_populated")
list_display = ("date", "name", "description", "category", "updated_at", "approved", "name_sort")
list_display = ("date", "name", "description", "category", "updated_at", "approved", "name_sort", "index_populated")
list_display_links = ("date", "name", "description", "category", "updated_at")
search_fields = ["date", "name", "description"]

Expand Down Expand Up @@ -576,7 +576,7 @@ class FederalRegisterDocumentAdmin(AbstractResourceAdmin):
form = FederalResourceForm
readonly_fields = ('index_populated', 'get_content')
list_display = ("date", "name", "description", "in_group", "docket_numbers",
"document_number", "category", "doc_type", "updated_at", "approved")
"document_number", "category", "doc_type", "updated_at", "approved", "index_populated")
list_display_links = ("date", "name", "description", "in_group", "docket_numbers",
"document_number", "category", "doc_type", "updated_at")
search_fields = ["date", "name", "description", "docket_numbers", "document_number"]
Expand Down

0 comments on commit 66a2efd

Please sign in to comment.