fix adding and removing tags via admin snapshot list

This commit is contained in:
Nick Sweeting 2021-03-27 05:27:02 -04:00
parent 49b77b91bb
commit 5568b3b612

View file

@ -213,10 +213,9 @@ class SnapshotAdmin(SearchResultsAdminMixin, admin.ModelAdmin):
delete_snapshots.short_description = "Delete" delete_snapshots.short_description = "Delete"
def add_tag(self, request, queryset): def add_tag(self, request, queryset):
if tag and tag.id: tag = request.POST['tag']
tag = request.POST['tag'] for obj in queryset:
for obj in queryset: obj.tags.add(tag)
obj.tags.add(tag)
add_tag.short_description = "Add tag" add_tag.short_description = "Add tag"