Skip to content

Commit

Permalink
There's some errors here.
Browse files Browse the repository at this point in the history
  • Loading branch information
BuildTools committed Oct 29, 2023
1 parent a9cafae commit c76e1e2
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 13 deletions.
1 change: 1 addition & 0 deletions api_v2/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class FeatAdmin(admin.ModelAdmin):
admin.site.register(Creature)
admin.site.register(CreatureAction)
admin.site.register(CreatureAttack)
admin.site.register(CreatureType)
admin.site.register(CreatureSet)


Expand Down
44 changes: 44 additions & 0 deletions api_v2/migrations/0013_auto_20231029_1144.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Generated by Django 3.2.20 on 2023-10-29 11:44

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


class Migration(migrations.Migration):

dependencies = [
('api_v2', '0012_alter_creatureset_type'),
]

operations = [
migrations.CreateModel(
name='CreatureType',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(help_text='Name of the item.', max_length=100)),
('desc', models.TextField(help_text='Description of the game content item. Markdown.')),
],
options={
'abstract': False,
},
),
migrations.RemoveField(
model_name='creature',
name='subtype',
),
migrations.RemoveField(
model_name='creatureset',
name='type',
),
migrations.AddField(
model_name='creatureset',
name='set_type',
field=models.TextField(choices=[('TAG', 'Tag')], default='TAG'),
preserve_default=False,
),
migrations.AlterField(
model_name='creature',
name='type',
field=models.ForeignKey(help_text='Type of creature.', on_delete=django.db.models.deletion.CASCADE, to='api_v2.creaturetype'),
),
]
1 change: 1 addition & 0 deletions api_v2/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from .creature import Creature
from .creature import CreatureAction
from .creature import CreatureAttack
from .creature import CreatureType
from .creature import CreatureSet

from .document import Document
Expand Down
24 changes: 11 additions & 13 deletions api_v2/models/creature.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,10 @@ class Creature(Object, Abilities, FromDocument):
help_text='What category this creature belongs to.'
)

type = models.CharField(
max_length=20,
choices=MONSTER_TYPES,
help_text='Which type of creature this is.'
)

subtype = models.CharField(
null=True,
max_length=100,
help_text='Which subtype or subtypes this creature has, if any.'
type = models.ForeignKey(
"CreatureType",
on_delete=models.CASCADE,
help_text='Type of creature.'
)

alignment = models.CharField(
Expand Down Expand Up @@ -141,6 +135,7 @@ def damage_type_field():
help_text='What kind of damage this attack deals.'
)


class CreatureAttack(HasName, FromDocument):

creature_action = models.ForeignKey(
Expand Down Expand Up @@ -195,13 +190,16 @@ class CreatureAttack(HasName, FromDocument):
extra_damage_type = damage_type_field()


class CreatureType(HasName, HasDescription):
"""Type of creature, such as Aberration."""


class CreatureSet(HasName, HasDescription, FromDocument):
"""A set of Creatures to be referenced."""

CREATURE_SET_TYPE_CHOICES = [('TYPE', "Type"),
('TAG', "Tag")]
CREATURE_SET_TYPE_CHOICES = [('TAG', "Tag")]

type = models.TextField(choices=CREATURE_SET_TYPE_CHOICES)
set_type = models.TextField(choices=CREATURE_SET_TYPE_CHOICES)

creatures = models.ManyToManyField(Creature, related_name="creaturesets",
help_text="The set of creatures.")

0 comments on commit c76e1e2

Please sign in to comment.