Skip to content

Commit

Permalink
Propagate venue deletions to BeerPrice instances (#232)
Browse files Browse the repository at this point in the history
That way when a venue closes, we don't have to manually delete
pricing info.

Fixes #231
  • Loading branch information
drewbrew authored Aug 12, 2019
1 parent d674b67 commit cf3fdfa
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions beers/migrations/0030_auto_20190807_2142.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 2.2.4 on 2019-08-07 21:42

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('beers', '0029_merge_20190519_1259'),
]

operations = [
migrations.AlterField(
model_name='beerprice',
name='venue',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='beer_prices', to='venues.Venue'),
),
]
2 changes: 1 addition & 1 deletion beers/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def __str__(self):
class BeerPrice(models.Model):
beer = models.ForeignKey(Beer, models.CASCADE, related_name='prices')
venue = models.ForeignKey(
'venues.Venue', models.DO_NOTHING, related_name='beer_prices',
'venues.Venue', models.CASCADE, related_name='beer_prices',
)
serving_size = models.ForeignKey(
ServingSize, models.DO_NOTHING, related_name='beer_prices',
Expand Down

0 comments on commit cf3fdfa

Please sign in to comment.