Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
concrexit
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
70
Issues
70
List
Boards
Labels
Service Desk
Milestones
Merge Requests
10
Merge Requests
10
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
thalia
concrexit
Commits
e241fb3c
Verified
Commit
e241fb3c
authored
May 16, 2018
by
Sébastiaan Versteeg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow the album cover to return None when the album has no images
parent
735514e6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
website/photos/models.py
website/photos/models.py
+2
-1
No files found.
website/photos/models.py
View file @
e241fb3c
...
...
@@ -167,9 +167,10 @@ class Album(models.Model, metaclass=ModelTranslateMeta):
@
cached_property
def
cover
(
self
):
cover
=
None
if
self
.
_cover
is
not
None
:
return
self
.
_cover
el
se
:
el
if
self
.
photo_set
.
exists
()
:
random
.
seed
(
self
.
dirname
)
cover
=
random
.
choice
(
self
.
photo_set
.
all
())
return
cover
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment