Skip to content

Commit

Permalink
Merge pull request #118 from soehlert/hotfix/state_admin
Browse files Browse the repository at this point in the history
style(venue): add state to venue string when its there
  • Loading branch information
soehlert authored Oct 20, 2023
2 parents 67cbf44 + 70cba6c commit ed67003
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions concerts/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,14 @@ class Venue(models.Model):
created_at = models.DateTimeField(auto_now_add=True)

class Meta:
unique_together = ["name", "city"]
constraints = [models.UniqueConstraint(fields=["name", "city", "state"], name="unique_venue")]

def __str__(self):
if self.country:
return str(f"{self.name} - {self.city}, {self.country}")
if self.state:
return str(f"{self.name} - {self.city}, {self.state}")
else:
return str(f"{self.name} - {self.city}, {self.country}")
else:
return str(f"{self.name} - {self.city}")

Expand Down

0 comments on commit ed67003

Please sign in to comment.