mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2026-04-05 07:17:52 +10:00
fix clicking add tag when no tag is selected throwing 500
This commit is contained in:
@@ -49,7 +49,6 @@ from django.contrib.admin.helpers import ActionForm
|
||||
|
||||
class SnapshotActionForm(ActionForm):
|
||||
tag = forms.ModelChoiceField(queryset=Tag.objects.all(), required=False)
|
||||
# pass
|
||||
|
||||
|
||||
class SnapshotAdmin(SearchResultsAdminMixin, admin.ModelAdmin):
|
||||
@@ -214,9 +213,10 @@ class SnapshotAdmin(SearchResultsAdminMixin, admin.ModelAdmin):
|
||||
delete_snapshots.short_description = "Delete"
|
||||
|
||||
def add_tag(self, request, queryset):
|
||||
tag = request.POST['tag']
|
||||
for obj in queryset:
|
||||
obj.tags.add(tag)
|
||||
if tag and tag.id:
|
||||
tag = request.POST['tag']
|
||||
for obj in queryset:
|
||||
obj.tags.add(tag)
|
||||
|
||||
add_tag.short_description = "Add tag"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user