forked from edwardchalstrey1/seshat
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Further refactoring (mostly class-based views)
- Loading branch information
1 parent
684ef0e
commit 4ee14d9
Showing
7 changed files
with
399 additions
and
321 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from django.urls import reverse | ||
from ..utils import deprecated | ||
|
||
|
||
class ZoteroMixIn: | ||
@property | ||
def __no_zotero_link__(self) -> str: | ||
return reverse("citation-update", args=[self.id]) | ||
|
||
@property | ||
def has_zotero(self) -> bool: | ||
return self.ref.has_zotero | ||
|
||
@property | ||
def zotero_link(self) -> str: | ||
""" | ||
Returns the Zotero link for the citation. | ||
Returns: | ||
str: The Zotero link for the citation. | ||
""" | ||
if self.has_zotero: | ||
return self.ref.full_zotero_link | ||
|
||
return self.__no_zotero_link__ | ||
|
||
@deprecated | ||
def zoteroer(self) -> str: | ||
""" | ||
For backward compatibility, this method returns the Zotero link for the citation. | ||
Returns: | ||
str: The Zotero link for the citation. | ||
Deprecated: | ||
Use the `zotero_link` property instead. | ||
""" | ||
return self.zotero_link |
Oops, something went wrong.