Show More
@@ -56,6 +56,15 b' class ThreadAdmin(admin.ModelAdmin):' | |||||
56 | def op(self, obj: Thread): |
|
56 | def op(self, obj: Thread): | |
57 | return obj.get_opening_post_id() |
|
57 | return obj.get_opening_post_id() | |
58 |
|
58 | |||
|
59 | # Save parent tags when editing tags | |||
|
60 | def save_related(self, request, form, formsets, change): | |||
|
61 | super().save_related(request, form, formsets, change) | |||
|
62 | obj = form.instance | |||
|
63 | for tag in obj.get_tags().all(): | |||
|
64 | parents = tag.get_all_parents() | |||
|
65 | if len(parents) > 0: | |||
|
66 | obj.tags.add(*parents) | |||
|
67 | ||||
59 | list_display = ('id', 'op', 'title', 'reply_count', 'status', 'ip', |
|
68 | list_display = ('id', 'op', 'title', 'reply_count', 'status', 'ip', | |
60 | 'display_tags') |
|
69 | 'display_tags') | |
61 | list_filter = ('bump_time', 'status') |
|
70 | list_filter = ('bump_time', 'status') |
General Comments 0
You need to be logged in to leave comments.
Login now