mirror of
https://github.com/ArchiveBox/ArchiveBox.git
synced 2025-05-12 22:25:44 -04:00
fix clicking add tag when no tag is selected throwing 500
This commit is contained in:
parent
76ff789164
commit
177d22da50
2 changed files with 6 additions and 6 deletions
|
@ -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"
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue