Skip to content

Commit 7e0fa93

Browse files
committed
FeatBenefit PK now a string, updated existing PKs
1 parent 200b1a8 commit 7e0fa93

File tree

7 files changed

+244
-204
lines changed

7 files changed

+244
-204
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Generated by Django 5.2.1 on 2025-10-02 21:58
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('api_v2', '0061_characterclass_desc_alter_abilitydescription_desc_and_more'),
10+
]
11+
12+
operations = [
13+
migrations.AlterModelOptions(
14+
name='featbenefit',
15+
options={'ordering': ['parent', 'order']},
16+
),
17+
migrations.RemoveField(
18+
model_name='featbenefit',
19+
name='id',
20+
),
21+
migrations.AddField(
22+
model_name='featbenefit',
23+
name='key',
24+
field=models.CharField(default='', help_text='Unique key for the Document.', max_length=100, primary_key=True, serialize=False),
25+
preserve_default=False,
26+
),
27+
migrations.AddField(
28+
model_name='featbenefit',
29+
name='order',
30+
field=models.SmallIntegerField(blank=True, help_text='The position in the list of features that this feature appears in its source statblock', null=True),
31+
),
32+
]

api_v2/models/feat.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""The model for a feat."""
22
from django.db import models
3-
from .abstracts import HasName, HasDescription, HasPrerequisite, Modification
3+
from .abstracts import HasName, HasDescription, HasPrerequisite, Modification, key_field
44
from .document import FromDocument
55

66
FEAT_TYPES = [
@@ -12,8 +12,16 @@
1212

1313
class FeatBenefit(Modification):
1414
"""This is the model for an individual benefit of a feat."""
15-
15+
key = key_field()
1616
parent = models.ForeignKey('Feat', on_delete=models.CASCADE)
17+
order = models.SmallIntegerField(
18+
blank=True,
19+
null=True,
20+
help_text='The position in the list of features that this feature appears in its source statblock'
21+
)
22+
23+
class Meta:
24+
ordering = ['parent', 'order']
1725

1826

1927
class Feat(HasName, HasDescription, HasPrerequisite, FromDocument):

0 commit comments

Comments
 (0)