Skip to content

Commit

Permalink
Ruleset to GameSystem
Browse files Browse the repository at this point in the history
  • Loading branch information
augustjohnson committed Oct 8, 2024
1 parent b64f78e commit ff06e25
Show file tree
Hide file tree
Showing 16 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ it with the content you add.
create a new one.
- `Publisher`: The publisher of the source. Select one of the available publishers. If the publisher is not available,
create a new one.
- `Ruleset`: The ruleset the source is associated with. Select one of the available rulesets. If the ruleset is not available,
- `GameSystem`: The ruleset the source is associated with. Select one of the available rulesets. If the ruleset is not available,
create a new one.
- `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`.
- `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.
Expand Down
2 changes: 1 addition & 1 deletion api_v2/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class LanguageAdmin(admin.ModelAdmin):
admin.site.register(Document)
admin.site.register(License)
admin.site.register(Publisher)
admin.site.register(Ruleset)
admin.site.register(GameSystem)

admin.site.register(DamageType)

Expand Down
8 changes: 4 additions & 4 deletions api_v2/management/commands/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ def handle(self, *args, **options) -> None:
self.stdout.write(self.style.SUCCESS('Data for v1 data complete.'))

# Start V2 output.
rulesets = Ruleset.objects.all()
rulesets = GameSystem.objects.all()
ruleset_path = get_filepath_by_model(
'Ruleset',
'GameSystem',
'api_v2',
base_path=options['dir'],
format=options['format'])
Expand Down Expand Up @@ -123,7 +123,7 @@ def handle(self, *args, **options) -> None:
write_queryset_data(doc_path, docq, format=options['format'])

for model in app_models:
SKIPPED_MODEL_NAMES = ['Document', 'Ruleset', 'License', 'Publisher','SearchResult']
SKIPPED_MODEL_NAMES = ['Document', 'GameSystem', 'License', 'Publisher','SearchResult']
CHILD_MODEL_NAMES = ['RaceTrait', 'FeatBenefit', 'BackgroundBenefit', 'ClassFeatureItem', 'SpellCastingOption','CreatureAction', 'CreatureTrait']
CHILD_CHILD_MODEL_NAMES = ['CreatureActionAttack']

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

if app_label == "api_v2":
root_folder_name = 'v2'
root_models = ['License', 'Ruleset']
root_models = ['License', 'GameSystem']
pub_models = ['Publisher']

if model_name in root_models:
Expand Down
2 changes: 1 addition & 1 deletion api_v2/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class Migration(migrations.Migration):
},
),
migrations.CreateModel(
name='Ruleset',
name='GameSystem',
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.')),
Expand Down
2 changes: 1 addition & 1 deletion api_v2/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from .document import Document
from .document import License
from .document import Publisher
from .document import Ruleset
from .document import GameSystem
from .document import FromDocument

from .damagetype import DamageType
Expand Down
6 changes: 3 additions & 3 deletions api_v2/models/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Document(HasName, HasDescription):
help_text="Publisher which has written the game content document.")

ruleset = models.ForeignKey(
"Ruleset",
"GameSystem",
on_delete=models.CASCADE,
help_text="The document's game system that it was published for."
)
Expand Down Expand Up @@ -55,7 +55,7 @@ def stats(self):

SKIPPED_MODEL_NAMES = [
'Document',
'Ruleset',
'GameSystem',
'License',
'Publisher',
'SearchResult']
Expand Down Expand Up @@ -103,7 +103,7 @@ class Publisher(HasName):
)


class Ruleset(HasName, HasDescription):
class GameSystem(HasName, HasDescription):
key = models.CharField(
primary_key=True,
max_length=100,
Expand Down
2 changes: 1 addition & 1 deletion api_v2/serializers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from .background import BackgroundBenefitSerializer
from .background import BackgroundSerializer

from .document import RulesetSerializer
from .document import GameSystemSerializer
from .document import LicenseSerializer
from .document import PublisherSerializer
from .document import DocumentSerializer
Expand Down
6 changes: 3 additions & 3 deletions api_v2/serializers/document.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
"""Serializers for Ruleset, License, Publisher, and Document models."""
"""Serializers for GameSystem, License, Publisher, and Document models."""
from rest_framework import serializers
from .abstracts import GameContentSerializer

from api_v2 import models

class RulesetSerializer(serializers.HyperlinkedModelSerializer):
class GameSystemSerializer(serializers.HyperlinkedModelSerializer):
key = serializers.ReadOnlyField()

class Meta:
model = models.Ruleset
model = models.GameSystem
fields = '__all__'


Expand Down
2 changes: 1 addition & 1 deletion api_v2/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from .creature import CreatureSetViewSet

from .document import DocumentViewSet
from .document import RulesetViewSet
from .document import GameSystemViewSet
from .document import PublisherViewSet
from .document import LicenseViewSet

Expand Down
8 changes: 4 additions & 4 deletions api_v2/views/document.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Viewsets for the Document, Ruleset, Publisher, and License Serializers."""
"""Viewsets for the Document, GameSystem, Publisher, and License Serializers."""
from rest_framework import viewsets
from django_filters import FilterSet, CharFilter
from django.db.models import JSONField
Expand All @@ -8,14 +8,14 @@



class RulesetViewSet(viewsets.ReadOnlyModelViewSet):
class GameSystemViewSet(viewsets.ReadOnlyModelViewSet):
""""
list: API Endpoint for returning a set of rulesets.
retrieve: API endpoint for return a particular ruleset.
"""
queryset = models.Ruleset.objects.all().order_by('pk')
serializer_class = serializers.RulesetSerializer
queryset = models.GameSystem.objects.all().order_by('pk')
serializer_class = serializers.GameSystemSerializer


class DocumentFilterSet(FilterSet):
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion docs/v2/data.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Within the v2 api, the data loading is completely distinct from the v1 data. It

Descriptions of the licenses for data that we serve, and rulesets for the data.
> /data/v2/License.json
> /data/v2/Ruleset.json
> /data/v2/GameSystem.json
Description of the organization or publishers of the data.
> /data/v2/{publisher-key}/Publisher.json
Expand Down
2 changes: 1 addition & 1 deletion scripts/data_manipulation/convertors/data_v2_fix_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def main():

# Get a list of files
files = glob.glob(args.directory + '/**/*.json', recursive=True)
excluded_files = ['Publisher.json','Document.json','Ruleset.json','License.json']
excluded_files = ['Publisher.json','Document.json','GameSystem.json','License.json']
file_list = []

for file in files:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def main():

# Get a list of files
files = glob.glob(args.directory + '/**/*.json', recursive=True)
excluded_files = ['Publisher.json','Document.json','Ruleset.json','License.json']
excluded_files = ['Publisher.json','Document.json','GameSystem.json','License.json']
file_list = []

for file in files:
Expand Down
2 changes: 1 addition & 1 deletion scripts/data_manipulation/convertors/v2_key_rewrite.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def key_rewrite():
docq = v2.Document.objects.filter(key=doc.key).order_by('pk')

for model in apps.get_models():
SKIPPED_MODEL_NAMES = ['Document', 'Ruleset', 'License', 'Publisher','SearchResult']
SKIPPED_MODEL_NAMES = ['Document', 'GameSystem', 'License', 'Publisher','SearchResult']
CHILD_MODEL_NAMES = ['Trait', 'Capability', 'Benefit', 'FeatureItem', 'CastingOption']

if model._meta.app_label == 'api_v2' and model.__name__ not in SKIPPED_MODEL_NAMES:
Expand Down
2 changes: 1 addition & 1 deletion server/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
router_v2.register(r'publishers',views_v2.PublisherViewSet)
router_v2.register(r'weapons',views_v2.WeaponViewSet)
router_v2.register(r'armor',views_v2.ArmorViewSet)
router_v2.register(r'rulesets',views_v2.RulesetViewSet)
router_v2.register(r'rulesets',views_v2.GameSystemViewSet)
router_v2.register(r'backgrounds',views_v2.BackgroundViewSet)
router_v2.register(r'feats',views_v2.FeatViewSet)
router_v2.register(r'races',views_v2.RaceViewSet)
Expand Down

0 comments on commit ff06e25

Please sign in to comment.