fnp
/
redakcja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix meta editor for ns-less tags.
[redakcja.git]
/
src
/
catalogue
/
wikidata.py
diff --git
a/src/catalogue/wikidata.py
b/src/catalogue/wikidata.py
index
88686b6
..
4fc8bbd
100644
(file)
--- a/
src/catalogue/wikidata.py
+++ b/
src/catalogue/wikidata.py
@@
-1,3
+1,6
@@
+# This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
+#
from datetime import date
from django.db import models
from django.db.models.signals import m2m_changed
from datetime import date
from django.db import models
from django.db.models.signals import m2m_changed
@@
-79,19
+82,19
@@
class WikidataMixin(models.Model):
wdvalue = wdvalue.label.get("pl", str(wdvalue.label))
setattr(self, attname, wdvalue)
wdvalue = wdvalue.label.get("pl", str(wdvalue.label))
setattr(self, attname, wdvalue)
-
-class WikidataAdminMixin:
- def save_related(self, request, form, formsets, change):
- super().save_related(request, form, formsets, change)
- form.instance.save()
-
- def wikidata_link(self, obj):
- if obj.wikidata:
+ def wikidata_link(self):
+ if self.wikidata:
return format_html(
'<a href="https://www.wikidata.org/wiki/{wd}" target="_blank">{wd}</a>',
return format_html(
'<a href="https://www.wikidata.org/wiki/{wd}" target="_blank">{wd}</a>',
- wd=
obj
.wikidata,
+ wd=
self
.wikidata,
)
else:
return ""
wikidata_link.admin_order_field = "wikidata"
)
else:
return ""
wikidata_link.admin_order_field = "wikidata"
+
+
+class WikidataAdminMixin:
+ def save_related(self, request, form, formsets, change):
+ super().save_related(request, form, formsets, change)
+ form.instance.save()