From 76284abb4e37acbc856f2ac4ce7d471ff60f656a Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sun, 29 Oct 2023 07:06:12 -0500 Subject: [PATCH] Adding new models. --- .../0011_creatureset_creaturetype.py | 38 +++++++++++++++++++ api_v2/models/creature.py | 11 ++++++ 2 files changed, 49 insertions(+) create mode 100644 api_v2/migrations/0011_creatureset_creaturetype.py diff --git a/api_v2/migrations/0011_creatureset_creaturetype.py b/api_v2/migrations/0011_creatureset_creaturetype.py new file mode 100644 index 00000000..4c4cf49a --- /dev/null +++ b/api_v2/migrations/0011_creatureset_creaturetype.py @@ -0,0 +1,38 @@ +# Generated by Django 3.2.20 on 2023-10-29 12:06 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('api_v2', '0010_rename_type_creature_deprecated_type'), + ] + + operations = [ + migrations.CreateModel( + name='CreatureType', + fields=[ + ('name', models.CharField(help_text='Name of the item.', max_length=100)), + ('desc', models.TextField(help_text='Description of the game content item. Markdown.')), + ('key', models.CharField(help_text='Unique key for the Item.', max_length=100, primary_key=True, serialize=False)), + ('document', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api_v2.document')), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='CreatureSet', + fields=[ + ('name', models.CharField(help_text='Name of the item.', max_length=100)), + ('key', models.CharField(help_text='Unique key for the Item.', max_length=100, primary_key=True, serialize=False)), + ('creatures', models.ManyToManyField(help_text='The set of creatures.', related_name='creaturesets', to='api_v2.Creature')), + ('document', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api_v2.document')), + ], + options={ + 'abstract': False, + }, + ), + ] diff --git a/api_v2/models/creature.py b/api_v2/models/creature.py index 511ebedd..63112fd7 100644 --- a/api_v2/models/creature.py +++ b/api_v2/models/creature.py @@ -194,3 +194,14 @@ class CreatureAttack(HasName, FromDocument): extra_damage_die_type = damage_die_type_field() extra_damage_bonus = damage_bonus_field() extra_damage_type = damage_type_field() + + +class CreatureType(HasName, HasDescription, FromDocument): + """The Type of creature, such as Aberration.""" + + +class CreatureSet(HasName, FromDocument): + """Set that the creature belongs to.""" + + creatures = models.ManyToManyField(Creature, related_name="creaturesets", + help_text="The set of creatures.") \ No newline at end of file