Skip to content

Commit

Permalink
Save album if no id before doing anything else
Browse files Browse the repository at this point in the history
  • Loading branch information
MaertHaekkinen committed Oct 23, 2024
1 parent 3e57b9f commit 9d910a3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ajapaik/ajapaik/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,9 @@ def __init__(self, *args, **kwargs):
self.original_lon = self.lon

def save(self, *args, **kwargs):
if not self.id:
super(Album, self).save(*args, **kwargs)

self.set_calculated_fields()
if not self.cover_photo and self.photo_count_with_subalbums > 0:
random_photo = self.photos.order_by('?').first()
Expand Down

0 comments on commit 9d910a3

Please sign in to comment.