Add sample habitat image and zone data

- Renames fixture scripts
This commit is contained in:
Dana Lambert 2021-11-10 17:34:16 +13:00
parent 1dcd42b6bc
commit 627816a3cd
14 changed files with 96 additions and 3 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.env

View file

@ -747,7 +747,7 @@
"model": "api.zone",
"pk": 63,
"fields": {
"name": "HERBACEOUS",
"name": "HERBACEOUS ",
"variant": "Border",
"refined_variant": null,
"redirect_habitat": null,

View file

@ -0,0 +1,20 @@
[
{
"model": "api.habitatimage",
"pk": 1,
"fields": {
"habitat": 7,
"name": "Mangrove",
"image_filename": "01-coastal-mangroves-marshes.png"
}
},
{
"model": "api.habitatimage",
"pk": 2,
"fields": {
"habitat": 7,
"name": "Salt Marsh",
"image_filename": "03-coastal-grass-reeds-scrub.png"
}
}
]

View file

@ -0,0 +1,52 @@
[
{
"model": "api.zoneimagesegment",
"pk": 1,
"fields": {
"zone": 58,
"habitat_image": 1,
"segment_order": 0,
"segment_percentage_width": 7.4
}
},
{
"model": "api.zoneimagesegment",
"pk": 2,
"fields": {
"zone": 126,
"habitat_image": 1,
"segment_order": 1,
"segment_percentage_width": 8.7
}
},
{
"model": "api.zoneimagesegment",
"pk": 3,
"fields": {
"zone": 98,
"habitat_image": 1,
"segment_order": 2,
"segment_percentage_width": 20.6
}
},
{
"model": "api.zoneimagesegment",
"pk": 4,
"fields": {
"zone": 77,
"habitat_image": 1,
"segment_order": 4,
"segment_percentage_width": 33.1
}
},
{
"model": "api.zoneimagesegment",
"pk": 5,
"fields": {
"zone": 66,
"habitat_image": 1,
"segment_order": 5,
"segment_percentage_width": 30.2
}
}
]

View file

@ -0,0 +1,18 @@
# Generated by Django 3.2.8 on 2021-11-10 02:04
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('api', '0006_auto_20211109_2255'),
]
operations = [
migrations.AlterField(
model_name='zoneimagesegment',
name='segment_percentage_width',
field=models.FloatField(default=0),
),
]

View file

@ -94,10 +94,10 @@ class ZoneImageSegment(models.Model):
habitat_image = models.ForeignKey(
HabitatImage, on_delete=models.CASCADE, related_name='image_segments')
segment_order = models.PositiveIntegerField(default=0)
segment_percentage_width = models.PositiveIntegerField(default=0)
segment_percentage_width = models.FloatField(default=0)
def __str__(self):
return f"{self.habitat_image.name}, {self.zone.name}"
return f"{self.habitat_image.name}, {self.zone}"
class Meta:
ordering = ['segment_order', 'id']

Binary file not shown.

After

Width:  |  Height:  |  Size: 427 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 KiB

View file

@ -20,6 +20,8 @@ export default function ZoneSelector(props) {
setHabitatImageFile(imageSrc)
findAndSetImageHeightFunc(imageSrc)
}
}).catch(e => {
findAndSetImageHeightFunc(habitatImageFile)
})
}