Skip to content

Commit 3f06040

Browse files
authored
fix: guard validate_unique against unsaved Release in admin add view (#2940)
1 parent 437abe9 commit 3f06040

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

apps/downloads/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ class ReleaseFile(ContentManageable, NameSlugModel):
361361

362362
def validate_unique(self, exclude=None):
363363
"""Ensure only one release file per OS has the download button enabled."""
364-
if self.download_button:
364+
if self.download_button and self.release_id:
365365
qs = ReleaseFile.objects.filter(release=self.release, os=self.os, download_button=True).exclude(pk=self.id)
366366
if qs.count() > 0:
367367
msg = 'Only one Release File per OS can have "Download button" enabled'

0 commit comments

Comments
 (0)