Skip to content

Commit d8ffa55

Browse files
Merge pull request open5e#561 from open5e/ruleset_to_gamesystem_refactor
Ruleset to gamesystem refactor
2 parents b64f78e + f29dca9 commit d8ffa55

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+79
-79
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ it with the content you add.
7979
create a new one.
8080
- `Publisher`: The publisher of the source. Select one of the available publishers. If the publisher is not available,
8181
create a new one.
82-
- `Ruleset`: The ruleset the source is associated with. Select one of the available rulesets. If the ruleset is not available,
82+
- `GameSystem`: The gamesystem the source is associated with. Select one of the available gamesystems. If the gamesystem is not available,
8383
create a new one.
8484
- `Author`: The author of the source. This can be a single author or a list of authors. List them in the format `Author 1, Author 2, Author 3`.
8585
- `Published at`: The Date and Time the source was published. Select the date it was published on. The time can be set to 00:00:00.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<p align="center">
55
<a href="https://open5e.com">https://open5e.com</a>
66
<br/>
7-
A JSON API for the D&D 5e ruleset
7+
A JSON API for the D&D 5e gamesystem
88
</p>
99
</p>
1010
<br />

api_v2/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class LanguageAdmin(admin.ModelAdmin):
7979
admin.site.register(Document)
8080
admin.site.register(License)
8181
admin.site.register(Publisher)
82-
admin.site.register(Ruleset)
82+
admin.site.register(GameSystem)
8383

8484
admin.site.register(DamageType)
8585

api_v2/management/commands/export.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@ def handle(self, *args, **options) -> None:
8383
self.stdout.write(self.style.SUCCESS('Data for v1 data complete.'))
8484

8585
# Start V2 output.
86-
rulesets = Ruleset.objects.all()
87-
ruleset_path = get_filepath_by_model(
88-
'Ruleset',
86+
gamesystems = GameSystem.objects.all()
87+
gamesystem_path = get_filepath_by_model(
88+
'GameSystem',
8989
'api_v2',
9090
base_path=options['dir'],
9191
format=options['format'])
92-
write_queryset_data(ruleset_path, rulesets, format=options['format'])
92+
write_queryset_data(gamesystem_path, gamesystems, format=options['format'])
9393

9494
license_path = get_filepath_by_model(
9595
'License',
@@ -123,7 +123,7 @@ def handle(self, *args, **options) -> None:
123123
write_queryset_data(doc_path, docq, format=options['format'])
124124

125125
for model in app_models:
126-
SKIPPED_MODEL_NAMES = ['Document', 'Ruleset', 'License', 'Publisher','SearchResult']
126+
SKIPPED_MODEL_NAMES = ['Document', 'GameSystem', 'License', 'Publisher','SearchResult']
127127
CHILD_MODEL_NAMES = ['RaceTrait', 'FeatBenefit', 'BackgroundBenefit', 'ClassFeatureItem', 'SpellCastingOption','CreatureAction', 'CreatureTrait']
128128
CHILD_CHILD_MODEL_NAMES = ['CreatureActionAttack']
129129

@@ -158,7 +158,7 @@ def get_filepath_by_model(model_name, app_label, pub_key=None, doc_key=None, bas
158158

159159
if app_label == "api_v2":
160160
root_folder_name = 'v2'
161-
root_models = ['License', 'Ruleset']
161+
root_models = ['License', 'GameSystem']
162162
pub_models = ['Publisher']
163163

164164
if model_name in root_models:

api_v2/migrations/0001_initial.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,11 @@ class Migration(migrations.Migration):
9595
},
9696
),
9797
migrations.CreateModel(
98-
name='Ruleset',
98+
name='GameSystem',
9999
fields=[
100100
('name', models.CharField(help_text='Name of the item.', max_length=100)),
101101
('desc', models.TextField(help_text='Description of the game content item. Markdown.')),
102-
('key', models.CharField(help_text='Unique key for the ruleset the document was published for.', max_length=100, primary_key=True, serialize=False)),
102+
('key', models.CharField(help_text='Unique key for the gamesystem the document was published for.', max_length=100, primary_key=True, serialize=False)),
103103
('content_prefix', models.CharField(blank=True, help_text='Short code prepended to content keys.', max_length=10)),
104104
],
105105
options={
@@ -533,8 +533,8 @@ class Migration(migrations.Migration):
533533
),
534534
migrations.AddField(
535535
model_name='document',
536-
name='ruleset',
537-
field=models.ForeignKey(help_text="The document's game system that it was published for.", on_delete=django.db.models.deletion.CASCADE, to='api_v2.ruleset'),
536+
name='gamesystem',
537+
field=models.ForeignKey(help_text="The document's game system that it was published for.", on_delete=django.db.models.deletion.CASCADE, to='api_v2.gamesystem'),
538538
),
539539
migrations.CreateModel(
540540
name='Size',

api_v2/models/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
from .document import Document
3232
from .document import License
3333
from .document import Publisher
34-
from .document import Ruleset
34+
from .document import GameSystem
3535
from .document import FromDocument
3636

3737
from .damagetype import DamageType

api_v2/models/creature.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class CreatureType(HasName, HasDescription, FromDocument):
2323

2424
class Creature(Object, HasAbilities, HasSenses, HasLanguage, HasSpeed, FromDocument):
2525
"""
26-
This is the model for a Creature, per the 5e ruleset.
26+
This is the model for a Creature, per the 5e gamesystem.
2727
2828
This extends the object and abilities models.
2929
"""

api_v2/models/document.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ class Document(HasName, HasDescription):
2121
on_delete=models.CASCADE,
2222
help_text="Publisher which has written the game content document.")
2323

24-
ruleset = models.ForeignKey(
25-
"Ruleset",
24+
gamesystem = models.ForeignKey(
25+
"GameSystem",
2626
on_delete=models.CASCADE,
2727
help_text="The document's game system that it was published for."
2828
)
@@ -55,7 +55,7 @@ def stats(self):
5555

5656
SKIPPED_MODEL_NAMES = [
5757
'Document',
58-
'Ruleset',
58+
'GameSystem',
5959
'License',
6060
'Publisher',
6161
'SearchResult']
@@ -103,11 +103,11 @@ class Publisher(HasName):
103103
)
104104

105105

106-
class Ruleset(HasName, HasDescription):
106+
class GameSystem(HasName, HasDescription):
107107
key = models.CharField(
108108
primary_key=True,
109109
max_length=100,
110-
help_text="Unique key for the ruleset the document was published for."
110+
help_text="Unique key for the gamesystem the document was published for."
111111
)
112112

113113
content_prefix = models.CharField(

api_v2/serializers/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from .background import BackgroundBenefitSerializer
1111
from .background import BackgroundSerializer
1212

13-
from .document import RulesetSerializer
13+
from .document import GameSystemSerializer
1414
from .document import LicenseSerializer
1515
from .document import PublisherSerializer
1616
from .document import DocumentSerializer

api_v2/serializers/document.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
"""Serializers for Ruleset, License, Publisher, and Document models."""
1+
"""Serializers for GameSystem, License, Publisher, and Document models."""
22
from rest_framework import serializers
33
from .abstracts import GameContentSerializer
44

55
from api_v2 import models
66

7-
class RulesetSerializer(serializers.HyperlinkedModelSerializer):
7+
class GameSystemSerializer(serializers.HyperlinkedModelSerializer):
88
key = serializers.ReadOnlyField()
99

1010
class Meta:
11-
model = models.Ruleset
11+
model = models.GameSystem
1212
fields = '__all__'
1313

1414

0 commit comments

Comments
 (0)