mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-07-19 12:59:36 +02:00
refactor: Update validation error message in Transportation model clean method
This commit is contained in:
parent
7c9afd8931
commit
581e5548d5
6 changed files with 249 additions and 84 deletions
|
@ -105,7 +105,7 @@ class Transportation(models.Model):
|
|||
def clean(self):
|
||||
if self.collection:
|
||||
if self.collection.is_public and not self.is_public:
|
||||
raise ValidationError('Transportations associated with a public collection must be public. Collection: ' + self.trip.name + ' Transportation: ' + self.name)
|
||||
raise ValidationError('Transportations associated with a public collection must be public. Collection: ' + self.collection.name + ' Transportation: ' + self.name)
|
||||
if self.user_id != self.collection.user_id:
|
||||
raise ValidationError('Transportations must be associated with collections owned by the same user. Collection owner: ' + self.collection.user_id.username + ' Transportation owner: ' + self.user_id.username)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue