Skip to content

Commit

Permalink
update files
Browse files Browse the repository at this point in the history
  • Loading branch information
peggles2 committed Sep 5, 2024
1 parent 3d5a49c commit 6325d10
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 19 deletions.
14 changes: 6 additions & 8 deletions solution/backend/resources/admin/internal_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ class InternalLinkForm(AbstractInternalResourceForm):
class InternalLinkAdmin(AbstractInternalResourceAdmin):
admin_priority = 20
form = InternalLinkForm
list_display = ["date", "document_id", "title", "category_name_without_annotation", "updated_at", "approved"]
list_display_links = ["date", "document_id", "title", "category_name_without_annotation", "updated_at", "approved"]
list_display = ["date", "document_id", "title", "category__name", "updated_at", "approved"]
list_display_links = ["date", "document_id", "title", "category__name", "updated_at", "approved"]
search_fields = ["date", "document_id", "title", "summary"]
ordering = ["-updated_at"]

fieldsets = [
("Basics", {
Expand Down Expand Up @@ -71,10 +72,10 @@ class InternalFileForm(AbstractInternalResourceForm):
class InternalFileAdmin(AbstractInternalResourceAdmin):
admin_priority = 21
form = InternalFileForm
list_display = ["date", "document_id", "title", "category", "updated_at", "approved"]
list_display_links = ["date", "document_id", "title", "category", "updated_at", "approved"]
list_display = ["date", "document_id", "title", "category__name", "updated_at", "approved"]
list_display_links = ["date", "document_id", "title", "category__name", "updated_at", "approved"]
search_fields = ["date", "document_id", "title", "summary"]
ordering = ["date", "document_id", "category", "updated_at"]
ordering = ["-updated_at"]
readonly_fields = ["download_file", "file_name", "file_type"]

fieldsets = [
Expand All @@ -95,9 +96,6 @@ class InternalFileAdmin(AbstractInternalResourceAdmin):
}),
]

def category_name_without_annotation(self, obj):
return obj.category.get_category_name_without_annotation() if obj.category else ""

class Media:
css = {
'all': ('css/admin/custom_admin.css',)
Expand Down
9 changes: 2 additions & 7 deletions solution/backend/resources/admin/public_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ class PublicLinkForm(AbstractPublicResourceForm):
class PublicLinkAdmin(AbstractPublicResourceAdmin):
admin_priority = 10
form = PublicLinkForm
list_display = ["date", "document_id", "title", "category_name_without_annotation", "updated_at", "approved"]
list_display_links = ["date", "document_id", "title", "category_name_without_annotation", "updated_at", "approved"]
list_display = ["date", "document_id", "title", "category__name", "updated_at", "approved"]
list_display_links = ["date", "document_id", "title", "category__name", "updated_at", "approved"]
search_fields = ["date", "document_id", "title", "url"]
ordering = ["-updated_at"]

Expand All @@ -53,11 +53,6 @@ class PublicLinkAdmin(AbstractPublicResourceAdmin):
}),
]

def category_name_without_annotation(self, obj):
return obj.category.get_category_name_without_annotation() if obj.category else ""

category_name_without_annotation.short_description = "Category"

class Media:
css = {
'all': ('css/admin/custom_admin.css',)
Expand Down
3 changes: 0 additions & 3 deletions solution/backend/resources/models/categories.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ def __str__(self):
name = getattr(self, "name", f"Category {self.pk}")
return f"{name} ({self._meta.verbose_name})"

def get_category_name_without_annotation(self):
return self.name


class AbstractPublicCategory(AbstractCategory):
pass
Expand Down
2 changes: 1 addition & 1 deletion solution/static-assets/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pyopenssl>=24,<25
Werkzeug==0.15.5
boto3
django-debug-toolbar
django>=5.0.7
django>=5.1
requests
djangorestframework
psycopg2-binary
Expand Down

0 comments on commit 6325d10

Please sign in to comment.