##// END OF EJS Templates
When editing tags in admin, add their parents as in a thread creation form
neko259 -
r1470:c40a0537 default
parent child Browse files
Show More
@@ -56,6 +56,15 b' class ThreadAdmin(admin.ModelAdmin):'
56 56 def op(self, obj: Thread):
57 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 68 list_display = ('id', 'op', 'title', 'reply_count', 'status', 'ip',
60 69 'display_tags')
61 70 list_filter = ('bump_time', 'status')
General Comments 0
You need to be logged in to leave comments. Login now