Skip to content

Commit

Permalink
✨ [#14] added admin page for informatie categorie
Browse files Browse the repository at this point in the history
  • Loading branch information
bart-maykin committed Sep 18, 2024
1 parent bb6c99f commit 4d30fe9
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/woo_publications/api/admin/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .category import * # noqa
22 changes: 22 additions & 0 deletions src/woo_publications/api/admin/category.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from django.contrib import admin

from ordered_model.admin import OrderedModelAdmin

from woo_publications.api.constants import InformatieCategorieChoices
from woo_publications.api.models import InformatieCategorie


@admin.register(InformatieCategorie)
class InformatieCategorieAdmin(OrderedModelAdmin):
list_display = ("identifier", "name", "order", "move_up_down_links")
readonly_fields = ("identifier",)
search_fields = (
"identifier",
"name",
)
list_filter = ("origin",)

def has_change_permission(self, request, obj=None):
if obj and obj.origin == InformatieCategorieChoices.waardelijst:
return False
return True
7 changes: 6 additions & 1 deletion src/woo_publications/fixtures/default_admin_index.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@
},
"name": "WOO publications",
"slug": "woo_publications",
"models": []
"models": [
[
"api",
"informatiecategorie"
]
]
}
},
{
Expand Down

0 comments on commit 4d30fe9

Please sign in to comment.