Make Photo.author a @property; None if no author.
				
					
				
			This commit is contained in:
		
							parent
							
								
									4836efcf23
								
							
						
					
					
						commit
						26a034c9a0
					
				
					 2 changed files with 8 additions and 2 deletions
				
			
		|  | @ -591,7 +591,13 @@ class Photo(ObjectBase): | |||
|         albums = [self.photodb.get_album(f[0]) for f in fetch] | ||||
|         return albums | ||||
| 
 | ||||
|     @property | ||||
|     def author(self): | ||||
|         ''' | ||||
|         Return the User object who owns this photo, or None if it is unassigned. | ||||
|         ''' | ||||
|         if self.author_id is None: | ||||
|             return None | ||||
|         return self.photodb.get_user(id=self.author_id) | ||||
| 
 | ||||
|     def bytestring(self): | ||||
|  |  | |||
|  | @ -184,8 +184,8 @@ | |||
|         </h4> | ||||
|         <ul id="metadata"> | ||||
|         <li>Filename: {{photo.basename}}</li> | ||||
|         {% if photo.author_id %} | ||||
|             {% set author = photo.author() %} | ||||
|         {% set author = photo.author %} | ||||
|         {% if author is not none %} | ||||
|             <li>Author: <a href="/user/{{author.username}}">{{author.username}}</a></li> | ||||
|         {% endif %} | ||||
|         {% if photo.width %} | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue