Skip to content

Commit

Permalink
Merge pull request #79 from cesarbruschetta/add-next-title
Browse files Browse the repository at this point in the history
Add method 'url_new_journal', 'url_previous_journal' in journal model
  • Loading branch information
Cesar Augusto authored Feb 7, 2019
2 parents c81be44 + 969a1cd commit a9e0b70
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions opac_schema/v1/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,31 @@ def url(self):
return URLegendarium(**leg_dict).url_journal


@property
def url_next_journal(self):
url_next_journal = ""
if self.next_title:
next_journal = self.__class__.objects(
title_slug=slugify(self.next_title)
).first()
if next_journal:
url_next_journal = URLegendarium(**{'acron': next_journal.acronym}).get_journal_seg()

return url_next_journal

@property
def url_previous_journal(self):
url_previous_journal = ""
if self.previous_journal_ref:
previous_journal = self.__class__.objects(
title_slug=slugify(self.previous_journal_ref)
).first()
if previous_journal:
url_previous_journal = URLegendarium(**{'acron': previous_journal.acronym}).get_journal_seg()

return url_previous_journal


signals.pre_save.connect(Journal.pre_save, sender=Journal)


Expand Down

0 comments on commit a9e0b70

Please sign in to comment.