[tasks] Add media url link
This commit is contained in:
@ -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
|
||||
|
||||
@ -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 %}
|
||||
|
||||
Reference in New Issue
Block a user