Alter the habitat image model to use a related name images

This commit is contained in:
Dana Lambert 2021-11-05 11:13:59 +13:00
parent 2f165e4b38
commit b5b39a5c18
2 changed files with 20 additions and 1 deletions

View file

@ -0,0 +1,19 @@
# Generated by Django 3.2.8 on 2021-11-04 04:52
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('api', '0003_plant_zones'),
]
operations = [
migrations.AlterField(
model_name='habitatimage',
name='habitat',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='images', to='api.habitat'),
),
]

View file

@ -61,7 +61,7 @@ class Habitat(models.Model):
class HabitatImage(models.Model):
habitat = models.ForeignKey(
Habitat, related_name='habitat', on_delete=models.CASCADE)
Habitat, related_name='images', on_delete=models.CASCADE)
name = models.CharField(max_length=50)
image_filename = models.CharField(max_length=50, default='-')