Make photo.duration_string a @property
This commit is contained in:
parent
d7cd1e9748
commit
afe7085702
4 changed files with 4 additions and 3 deletions
|
@ -33,7 +33,7 @@ def photo(p, include_albums=True, include_tags=True):
|
|||
'ratio': p.ratio,
|
||||
'area': p.area,
|
||||
'bytes': p.bytes,
|
||||
'duration_str': p.duration_string(),
|
||||
'duration_str': p.duration_string,
|
||||
'duration': p.duration,
|
||||
'bytes_str': p.bytestring(),
|
||||
'has_thumbnail': bool(p.thumbnail),
|
||||
|
|
|
@ -505,6 +505,7 @@ class Photo(ObjectBase):
|
|||
self.photodb.log.debug('Committing - delete photo')
|
||||
self.photodb.commit()
|
||||
|
||||
@property
|
||||
def duration_string(self):
|
||||
if self.duration is None:
|
||||
return None
|
||||
|
|
|
@ -169,7 +169,7 @@
|
|||
{% endif %}
|
||||
<li>Size: {{photo.bytestring()}}</li>
|
||||
{% if photo.duration %}
|
||||
<li>Duration: {{photo.duration_string()}}</li>
|
||||
<li>Duration: {{photo.duration_string}}</li>
|
||||
{% endif %}
|
||||
<li><a href="/file/{{photo.id}}{{photo.dot_extension}}?download=1">Download as {{photo.id}}.{{photo.extension}}</a></li>
|
||||
<li><a href="/file/{{photo.id}}{{photo.dot_extension}}?download=1&original_filename=1">Download as "{{photo.basename}}"</a></li>
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
{{photo.width}}×{{photo.height}},
|
||||
{% endif %}
|
||||
{% if photo.duration %}
|
||||
{{photo.duration_string()}},
|
||||
{{photo.duration_string}},
|
||||
{% endif %}
|
||||
<a target="_blank" href="/file/{{photo.id}}.{{photo.extension}}">{{photo.bytestring()}}</a>
|
||||
</span>
|
||||
|
|
Loading…
Reference in a new issue