Skip to content
This repository was archived by the owner on Jun 1, 2022. It is now read-only.

Commit 0ffa874

Browse files
committed
Reenable adding/editing related topics for docs, notes
Also fix bug when editing documents where the "zotero_link" attribute was not being set properly
1 parent 27ecb68 commit 0ffa874

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

editorsnotes/admin_custom/forms/documents.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ def save_zotero_data(self):
4040
elif self.changed_data is not None and 'zotero_string' in self.changed_data:
4141
document.zotero_data = self.cleaned_data['zotero_string']
4242
document.save()
43-
link, created = ZoteroLink.objects.get_or_create(zotero_item=document)
44-
if not created:
45-
link.save()
43+
if not document.zotero_link:
44+
ZoteroLink.objects.create(zotero_item=document)
45+
else:
46+
document.zotero_link.save()
4647
return document
4748

4849
class DocumentLinkForm(ModelForm):

editorsnotes/admin_custom/views/documents.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class DocumentAdminView(BaseAdminView):
1414
model = Document
1515
form_class = forms.DocumentForm
1616
formset_classes = (
17-
# forms.TopicAssignmentFormset,
17+
forms.TopicAssignmentFormset,
1818
forms.DocumentLinkFormset,
1919
forms.ScanFormset
2020
)

editorsnotes/admin_custom/views/notes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class NoteAdminView(BaseAdminView):
1818
model = Note
1919
form_class = forms.NoteForm
2020
formset_classes = (
21-
# forms.TopicAssignmentFormset,
21+
forms.common.TopicAssignmentFormset,
2222
)
2323
template_name = 'note_admin.html'
2424
def get_object(self, note_id=None):

0 commit comments

Comments
 (0)