[tasks] Add media url link

This commit is contained in:
2024-10-05 17:58:12 -04:00
parent 6764023016
commit 164510b7b7
2 changed files with 12 additions and 1 deletions

View File

@ -934,6 +934,17 @@ class Scrobble(TimeStampedModel):
last_page = pages[-1]
return last_page
@property
def get_media_source_url(self) -> str:
url = ""
if self.media_type == "Website":
url = self.media_obj.url
if self.media_type == "Task" and self.logdata.source_id:
url = self.media_obj.source_url_pattern.format(
id=self.logdata.source_id
)
return url
@classmethod
def create_or_update(
cls, media, user_id: int, scrobble_data: dict, **kwargs

View File

@ -60,7 +60,7 @@
{% for scrobble in object.scrobble_set.all|dictsortreversed:"timestamp" %}
<tr>
<td>{{scrobble.timestamp}}</td>
<td><a href="{{scrobble.source_url_for_user}}">{{scrobble.logdata.description}}</a></td>
<td><a href="{{scrobble.get_media_source_url}}">{{scrobble.logdata.description}}</a></td>
<td>{{scrobble.source}}</td>
</tr>
{% endfor %}