Skip to content

Commit

Permalink
feat(admin): ajoute PostInline à TopicAdmin (#657)
Browse files Browse the repository at this point in the history
## Description

🎸 Ajoute une class `Inline` pour les messages sur un Topic

## Type de changement

🪲 Correction de bug (changement non cassant qui corrige un problème).
🎢 Nouvelle fonctionnalité (changement non cassant qui ajoute une
fonctionnalité).

### Captures d'écran (optionnel)

<img width="1264" alt="Screenshot 2024-06-04 at 17 21 17"
src="https://github.com/gip-inclusion/itou-communaute-django/assets/10801930/bb5ca2c2-6893-48f7-8983-5dac1bbd5431">
  • Loading branch information
calummackervoy authored Jun 5, 2024
1 parent cf9bc6e commit 6f3049a
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion lacommunaute/forum_conversation/admin.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
from django.contrib import admin
from machina.apps.forum_conversation.admin import TopicAdmin as BaseTopicAdmin

from lacommunaute.forum_conversation.models import CertifiedPost
from lacommunaute.forum_conversation.models import CertifiedPost, Post, Topic


class PostInline(admin.StackedInline):
model = Post
list_display = ("__str__", "poster", "updated", "approved")
raw_id_fields = (
"poster",
"topic",
)
extra = 0


class TopicAdmin(BaseTopicAdmin):
raw_id_fields = (
"poster",
"subscribers",
)
inlines = [
PostInline,
]


class CertifiedPostAdmin(admin.ModelAdmin):
Expand All @@ -20,4 +33,6 @@ class CertifiedPostAdmin(admin.ModelAdmin):
)


admin.site.unregister(Topic)
admin.site.register(Topic, TopicAdmin)
admin.site.register(CertifiedPost, CertifiedPostAdmin)

0 comments on commit 6f3049a

Please sign in to comment.