-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ [#14] added admin page for informatie categorie
- Loading branch information
1 parent
bb6c99f
commit 4d30fe9
Showing
3 changed files
with
29 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .category import * # noqa |
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,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 |
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