Add sample habitat image and zone data
- Renames fixture scripts
This commit is contained in:
parent
1dcd42b6bc
commit
627816a3cd
14 changed files with 96 additions and 3 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
.env
|
|
@ -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"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
|
@ -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),
|
||||||
|
),
|
||||||
|
]
|
|
@ -94,10 +94,10 @@ class ZoneImageSegment(models.Model):
|
||||||
habitat_image = models.ForeignKey(
|
habitat_image = models.ForeignKey(
|
||||||
HabitatImage, on_delete=models.CASCADE, related_name='image_segments')
|
HabitatImage, on_delete=models.CASCADE, related_name='image_segments')
|
||||||
segment_order = models.PositiveIntegerField(default=0)
|
segment_order = models.PositiveIntegerField(default=0)
|
||||||
segment_percentage_width = models.PositiveIntegerField(default=0)
|
segment_percentage_width = models.FloatField(default=0)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{self.habitat_image.name}, {self.zone.name}"
|
return f"{self.habitat_image.name}, {self.zone}"
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ['segment_order', 'id']
|
ordering = ['segment_order', 'id']
|
||||||
|
|
BIN
frontend/src/assets/img/habitats/01-coastal-mangroves-marshes.png
Executable file
BIN
frontend/src/assets/img/habitats/01-coastal-mangroves-marshes.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 427 KiB |
BIN
frontend/src/assets/img/habitats/03-coastal-grass-reeds-scrub.png
Executable file
BIN
frontend/src/assets/img/habitats/03-coastal-grass-reeds-scrub.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 157 KiB |
|
@ -20,6 +20,8 @@ export default function ZoneSelector(props) {
|
||||||
setHabitatImageFile(imageSrc)
|
setHabitatImageFile(imageSrc)
|
||||||
findAndSetImageHeightFunc(imageSrc)
|
findAndSetImageHeightFunc(imageSrc)
|
||||||
}
|
}
|
||||||
|
}).catch(e => {
|
||||||
|
findAndSetImageHeightFunc(habitatImageFile)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue