Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .idea/hellforge.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 47 additions & 0 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions main/migrations/0174_colours.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 5.1.3 on 2025-09-19 19:38

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('main', '0173_project_parameters'),
]

operations = [
migrations.CreateModel(
name='Colours',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('colour_name', models.CharField(max_length=64)),
('colour_munsell', models.CharField(max_length=32)),
],
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Generated by Django 5.1.3 on 2025-09-23 19:39

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('main', '0174_colours'),
]

operations = [
migrations.CreateModel(
name='ColourMunsell',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('colour_munsell', models.CharField(max_length=32)),
('is_default', models.BooleanField(default=False)),
],
),
migrations.CreateModel(
name='ColourName',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=64)),
('is_default', models.BooleanField(default=False)),
],
),
migrations.DeleteModel(
name='Colours',
),
migrations.AddField(
model_name='colourmunsell',
name='colour_name',
field=models.ManyToManyField(related_name='munsell_value', to='main.colourname'),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated by Django 5.1.3 on 2025-09-26 20:42

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


class Migration(migrations.Migration):

dependencies = [
('main', '0175_colourmunsell_colourname_delete_colours_and_more'),
]

operations = [
migrations.RemoveField(
model_name='layer',
name='colour_hex',
),
migrations.AlterField(
model_name='layer',
name='colour',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='colour', to='main.colourname'),
),
migrations.AlterField(
model_name='layer',
name='colour_munsell',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='munsell', to='main.colourmunsell'),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 5.1.3 on 2025-09-26 21:13

import django.core.validators
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('main', '0176_remove_layer_colour_hex_alter_layer_colour_and_more'),
]

operations = [
migrations.AlterField(
model_name='layer',
name='colour',
field=models.CharField(blank=True, max_length=200, null=True, verbose_name='colour'),
),
migrations.AlterField(
model_name='layer',
name='colour_munsell',
field=models.CharField(blank=True, max_length=200, null=True, validators=[django.core.validators.RegexValidator(code='invalid_registration', message='Enter a valid Munsell Number in the format 8.75YR 4.5/3', regex='^[0-9]+(\\.[0-9]+)?[A-Z]+\\s+[1-9](\\.[0-9]+)?/[0-9]+(\\.[0-9]+)?$')], verbose_name='colour_munsell'),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 5.1.3 on 2025-09-27 16:01

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


class Migration(migrations.Migration):

dependencies = [
('main', '0177_alter_layer_colour_alter_layer_colour_munsell'),
]

operations = [
migrations.AlterField(
model_name='layer',
name='colour',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='colour', to='main.colourname'),
),
migrations.AlterField(
model_name='layer',
name='colour_munsell',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='munsell', to='main.colourmunsell'),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 5.1.3 on 2025-09-29 20:21

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


class Migration(migrations.Migration):

dependencies = [
('main', '0178_alter_layer_colour_alter_layer_colour_munsell'),
]

operations = [
migrations.AlterField(
model_name='layer',
name='colour',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='colour', to='main.colourname'),
),
migrations.AlterField(
model_name='layer',
name='colour_munsell',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='munsell', to='main.colourmunsell'),
),
]
29 changes: 29 additions & 0 deletions main/migrations/0180_texturecategory_texturekeyword.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generated by Django 5.1.3 on 2025-09-30 20:20

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


class Migration(migrations.Migration):

dependencies = [
('main', '0179_alter_layer_colour_alter_layer_colour_munsell'),
]

operations = [
migrations.CreateModel(
name='TextureCategory',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('category', models.CharField(max_length=32)),
],
),
migrations.CreateModel(
name='TextureKeyword',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('texture', models.CharField(max_length=64)),
('texture_category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='texture_category', to='main.texturecategory')),
],
),
]
55 changes: 40 additions & 15 deletions main/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
from django.db import models
from django.urls import reverse
from django.db.models import Q
from django.db.models import Q, CASCADE
from django.core.validators import RegexValidator
from django.contrib.contenttypes.fields import GenericForeignKey # for the description
from django.contrib.contenttypes.models import ContentType # for the description
Expand Down Expand Up @@ -1083,6 +1083,21 @@ def get_data(self, **kwargs):
'Silt'
]}

class ColourName(models.Model):
name = models.CharField(max_length=64)
is_default = models.BooleanField(default=False)

class ColourMunsell(models.Model):
colour_munsell = models.CharField(max_length=32)
colour_name = models.ManyToManyField(ColourName, related_name="munsell_value")
is_default = models.BooleanField(default=False)

class TextureCategory(models.Model):
category = models.CharField(max_length=32)

class TextureKeyword(models.Model):
texture = models.CharField(max_length=64)
texture_category = models.ForeignKey(TextureCategory, on_delete=models.CASCADE, related_name="texture_category")

class Layer(Dateable):
name = models.CharField("name", max_length=200)
Expand Down Expand Up @@ -1130,21 +1145,24 @@ class Layer(Dateable):
null=True,
)
# fields related to geological sediment properties
colour = models.CharField("colour",max_length=200, blank=True, null=True) # this is the "informal" name
colour_munsell = models.CharField(
"colour_munsell",
max_length=200,
validators=[
RegexValidator(
regex=r'^[0-9]+(\.[0-9]+)?[A-Z]+\s+[1-9](\.[0-9]+)?/[0-9]+(\.[0-9]+)?$',
message="Enter a valid Munsell Number in the format 8.75YR 4.5/3",
code="invalid_registration",
),
],
blank=True,
null=True) # The Munsell Color Code
colour_hex = models.CharField("colour_rgb", max_length=200, blank=True, null=True) # The hex value calculated from Munsell
#colour = models.CharField("colour",max_length=200, blank=True, null=True) # this is the "informal" name
#colour_munsell = models.CharField(
# "colour_munsell",
# max_length=200,
# validators=[
# RegexValidator(
# regex=r'^[0-9]+(\.[0-9]+)?[A-Z]+\s+[1-9](\.[0-9]+)?/[0-9]+(\.[0-9]+)?$',
# message="Enter a valid Munsell Number in the format 8.75YR 4.5/3",
# code="invalid_registration",
# ),
# ],
# blank=True,
# null=True) # The Munsell Color Code
colour = models.ForeignKey(ColourName, blank=True, null=True, on_delete=models.SET_NULL, related_name="colour")
colour_munsell = models.ForeignKey(ColourMunsell, blank=True, null=True, on_delete=models.SET_NULL, related_name="munsell")
#colour_hex = models.CharField("colour_rgb", max_length=200, blank=True, null=True) # The hex value calculated from Munsell
texture = models.CharField("texture", max_length=200, blank=True, null=True, choices=texture_choices)
texture_keyword = models.ForeignKey(TextureKeyword, blank=True, null=True, on_delete=models.SET_NULL, related_name="texture")

#
## References
Expand Down Expand Up @@ -1775,6 +1793,13 @@ def get_data(self, **kwargs):
new_data = {(f"MM_{k}" if k in duplicates else k):v for k,v in data.items() } # preserve column names in data
return new_data

#
#
# Classes for Colour and Texture Databases
#
#



models = {
"site": Site,
Expand Down
Loading