Skip to content

Commit

Permalink
Adding new models.
Browse files Browse the repository at this point in the history
  • Loading branch information
BuildTools committed Oct 29, 2023
1 parent 64ee133 commit 76284ab
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
38 changes: 38 additions & 0 deletions api_v2/migrations/0011_creatureset_creaturetype.py
Original file line number Diff line number Diff line change
@@ -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,
},
),
]
11 changes: 11 additions & 0 deletions api_v2/models/creature.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")

0 comments on commit 76284ab

Please sign in to comment.