Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added InterneTakenActoren to the admin #287

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,)
Loading
Loading