Skip to content

Commit

Permalink
feat: Venue-Specific Accessibility Information (#721)
Browse files Browse the repository at this point in the history
* Add a accessibility_info field for venues

* Fix querying a venue's productions returning duplicate productions

* Updated schema

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
HappyNTH and github-actions[bot] authored Oct 9, 2024
1 parent b06f113 commit e8b1bea
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
1 change: 1 addition & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,7 @@ type VenueNode implements Node {
name: String!
internalCapacity: Int!
description: String
accessibilityInfo: String
address: AddressNode!
image: ImageNode!
publiclyListed: Boolean!
Expand Down
18 changes: 18 additions & 0 deletions uobtheatre/venues/migrations/0005_venue_accessibility_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.18 on 2024-03-06 23:24

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("venues", "0004_alter_venue_internal_capacity"),
]

operations = [
migrations.AddField(
model_name="venue",
name="accessibility_info",
field=models.TextField(blank=True, null=True),
),
]
3 changes: 2 additions & 1 deletion uobtheatre/venues/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class Venue(TimeStampedMixin, BaseModel):
name = models.CharField(max_length=255)
internal_capacity = models.PositiveSmallIntegerField()
description = TipTapTextField(null=True, blank=True)
accessibility_info = models.TextField(null=True, blank=True)
address = models.ForeignKey(Address, on_delete=models.CASCADE)
image = models.ForeignKey(Image, on_delete=models.RESTRICT, related_name="venues")
publicly_listed = models.BooleanField(default=True)
Expand All @@ -45,7 +46,7 @@ def get_productions(self):
list of Production: A list of all the productions in this Venue.
"""
production_model = apps.get_model("productions", "production")
return production_model.objects.filter(performances__venue=self)
return production_model.objects.filter(performances__venue=self).distinct()

def __str__(self):
return str(self.name)
Expand Down
1 change: 1 addition & 0 deletions uobtheatre/venues/test/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def test_venue_productions():
production_2 = ProductionFactory()

PerformanceFactory(production=production_1, venue=venue1)
PerformanceFactory(production=production_1, venue=venue1) # Catching productions being duplicated by .fliter() when there are multiple performance in the same venue
PerformanceFactory(production=production_1, venue=venue2)
PerformanceFactory(production=production_2, venue=venue2)

Expand Down

0 comments on commit e8b1bea

Please sign in to comment.