Skip to content

Commit

Permalink
Merge pull request #537 from tylereed/486-add-subcategory
Browse files Browse the repository at this point in the history
Splitting creature category to category and subcategory
  • Loading branch information
augustjohnson authored Oct 3, 2024
2 parents 32baee2 + 250e56e commit 91a33bf
Show file tree
Hide file tree
Showing 13 changed files with 3,363 additions and 126 deletions.
18 changes: 18 additions & 0 deletions api_v2/migrations/0119_creature_subcategory.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.20 on 2024-09-27 10:43

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('api_v2', '0118_creatureaction_form_condition'),
]

operations = [
migrations.AddField(
model_name='creature',
name='subcategory',
field=models.CharField(help_text='What subcategory this creature belongs to.', max_length=100, null=True),
),
]
6 changes: 6 additions & 0 deletions api_v2/models/creature.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ class Creature(Object, HasAbilities, HasSenses, HasLanguage, HasSpeed, FromDocum
help_text='What category this creature belongs to.'
)

subcategory = models.CharField(
max_length=100,
null=True,
help_text='What subcategory this creature belongs to.'
)

alignment = models.CharField(
max_length=100,
help_text='The creature\'s allowed alignments.'
Expand Down
1 change: 1 addition & 0 deletions api_v2/serializers/creature.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ class Meta:
'speed',
'speed_all',
'category',
'subcategory',
'type',
'alignment',
'languages',
Expand Down
2 changes: 2 additions & 0 deletions api_v2/views/creature.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class Meta:
'document__key': ['in','iexact','exact'],
'document__ruleset__key': ['in','iexact','exact'],
'size': ['exact'],
'category': ['exact', 'iexact'],
'subcategory': ['exact', 'iexact'],
'type': ['exact'],
'challenge_rating_decimal': ['exact','lt','lte','gt','gte'],
'armor_class': ['exact','lt','lte','gt','gte'],
Expand Down
Loading

0 comments on commit 91a33bf

Please sign in to comment.