Skip to content

Commit

Permalink
fixing project is not found in version
Browse files Browse the repository at this point in the history
  • Loading branch information
meomancer committed Jul 19, 2016
1 parent 76439a7 commit ddd3f3b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions django_project/changes/models/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,13 @@ class Meta:
# ordering = ['-datetime_created']

def clean(self):
if not self.project.approved:
raise ValidationError(
"can't create version because project is not approved yet")
from base.models.project import Project
try:
if self.project.approved:
raise ValidationError(
"can't create version because project is not approved yet")
except Project.DoesNotExist:
pass

def save(self, *args, **kwargs):
if not self.pk:
Expand Down

0 comments on commit ddd3f3b

Please sign in to comment.