Rename Photo.albums -> get_containing_albums.
This commit is contained in:
parent
2f9b51b636
commit
205c49c21f
3 changed files with 12 additions and 12 deletions
|
@ -55,7 +55,7 @@ def photo(p, include_albums=True, include_tags=True):
|
||||||
'mimetype': p.mimetype,
|
'mimetype': p.mimetype,
|
||||||
}
|
}
|
||||||
if include_albums:
|
if include_albums:
|
||||||
j['albums'] = [album(a, minimal=True) for a in p.albums()]
|
j['albums'] = [album(a, minimal=True) for a in p.get_containing_albums()]
|
||||||
|
|
||||||
if include_tags:
|
if include_tags:
|
||||||
j['tags'] = [tag(t) for t in tags]
|
j['tags'] = [tag(t) for t in tags]
|
||||||
|
|
|
@ -635,16 +635,6 @@ class Photo(ObjectBase):
|
||||||
self.photodb.commit()
|
self.photodb.commit()
|
||||||
return tag
|
return tag
|
||||||
|
|
||||||
def albums(self):
|
|
||||||
'''
|
|
||||||
Return the albums of which this photo is a member.
|
|
||||||
'''
|
|
||||||
cur = self.photodb.sql.cursor()
|
|
||||||
cur.execute('SELECT albumid FROM album_photo_rel WHERE photoid == ?', [self.id])
|
|
||||||
fetches = cur.fetchall()
|
|
||||||
albums = [self.photodb.get_album(id=fetch[0]) for fetch in fetches]
|
|
||||||
return albums
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def author(self):
|
def author(self):
|
||||||
'''
|
'''
|
||||||
|
@ -792,6 +782,16 @@ class Photo(ObjectBase):
|
||||||
self.__reinit__()
|
self.__reinit__()
|
||||||
return self.thumbnail
|
return self.thumbnail
|
||||||
|
|
||||||
|
def get_containing_albums(self):
|
||||||
|
'''
|
||||||
|
Return the albums of which this photo is a member.
|
||||||
|
'''
|
||||||
|
cur = self.photodb.sql.cursor()
|
||||||
|
cur.execute('SELECT albumid FROM album_photo_rel WHERE photoid == ?', [self.id])
|
||||||
|
fetches = cur.fetchall()
|
||||||
|
albums = [self.photodb.get_album(id=fetch[0]) for fetch in fetches]
|
||||||
|
return albums
|
||||||
|
|
||||||
def get_tags(self):
|
def get_tags(self):
|
||||||
'''
|
'''
|
||||||
Return the tags assigned to this Photo.
|
Return the tags assigned to this Photo.
|
||||||
|
|
|
@ -202,7 +202,7 @@
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<!-- CONTAINING ALBUMS -->
|
<!-- CONTAINING ALBUMS -->
|
||||||
{% set albums = photo.albums() %}
|
{% set albums = photo.get_containing_albums() %}
|
||||||
{% if albums %}
|
{% if albums %}
|
||||||
<h4>Albums containing this photo</h4>
|
<h4>Albums containing this photo</h4>
|
||||||
<ul id="containing albums">
|
<ul id="containing albums">
|
||||||
|
|
Loading…
Reference in a new issue