Skip to content

Commit

Permalink
✨ [#251] added admin tabular inlines for InterneTakenActorenThoughMod…
Browse files Browse the repository at this point in the history
…el in both admin pages
  • Loading branch information
bart-maykin committed Nov 22, 2024
1 parent be19464 commit 0724b83
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/openklant/components/klantinteracties/admin/actoren.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ class ActorKlantcontactInlineAdmin(admin.StackedInline):
extra = 0


class InterneTaakInlineAdmin(admin.StackedInline):
model = Actor.internetaak_set.through
raw_id_fields = ("internetaak",)
verbose_name = _("Interne taak")
verbose_name_plural = _("Interne taken")
extra = 0


@admin.register(Actor)
class ActorAdmin(admin.ModelAdmin):
list_display = (
Expand All @@ -51,6 +59,7 @@ class ActorAdmin(admin.ModelAdmin):
GeautomatiseerdeActorInlineAdmin,
MedewerkerInlineAdmin,
OrganisatorischeEenheidInlineAdmin,
InterneTaakInlineAdmin,
)
fieldsets = (
(
Expand Down
11 changes: 11 additions & 0 deletions src/openklant/components/klantinteracties/admin/internetaken.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.contrib import admin
from django.utils.translation import gettext_lazy as _

from ..models.internetaken import InterneTaak

Expand All @@ -10,6 +11,14 @@ class InterneTaakInlineAdmin(admin.StackedInline):
readonly_fields = ("uuid",)


class ActorInlineAdmin(admin.StackedInline):
model = InterneTaak.actoren.through
raw_id_fields = ("actor",)
verbose_name = _("Actor")
verbose_name_plural = _("Actoren")
extra = 0


@admin.register(InterneTaak)
class InterneTaakAdmin(admin.ModelAdmin):
readonly_fields = ("uuid",)
Expand All @@ -19,6 +28,7 @@ class InterneTaakAdmin(admin.ModelAdmin):
"toegewezen_op",
"afgehandeld_op",
)
search_fields = ("nummer",)
list_filter = (
"actoren",
"status",
Expand All @@ -27,3 +37,4 @@ class InterneTaakAdmin(admin.ModelAdmin):
"uuid",
"toegewezen_op",
)
inlines = (ActorInlineAdmin,)

0 comments on commit 0724b83

Please sign in to comment.