diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a3b1cb95..d3f9bdea 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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. diff --git a/api_v2/admin.py b/api_v2/admin.py index fd8e39fa..bb9200e0 100644 --- a/api_v2/admin.py +++ b/api_v2/admin.py @@ -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) diff --git a/api_v2/management/commands/export.py b/api_v2/management/commands/export.py index cadf64c5..6f5dc963 100644 --- a/api_v2/management/commands/export.py +++ b/api_v2/management/commands/export.py @@ -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']) @@ -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'] @@ -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: diff --git a/api_v2/migrations/0001_initial.py b/api_v2/migrations/0001_initial.py index ac073122..f1ece946 100644 --- a/api_v2/migrations/0001_initial.py +++ b/api_v2/migrations/0001_initial.py @@ -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.')), diff --git a/api_v2/models/__init__.py b/api_v2/models/__init__.py index 27cefeec..79ea0ae6 100644 --- a/api_v2/models/__init__.py +++ b/api_v2/models/__init__.py @@ -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 diff --git a/api_v2/models/document.py b/api_v2/models/document.py index cee1e817..76968e60 100644 --- a/api_v2/models/document.py +++ b/api_v2/models/document.py @@ -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." ) @@ -55,7 +55,7 @@ def stats(self): SKIPPED_MODEL_NAMES = [ 'Document', - 'Ruleset', + 'GameSystem', 'License', 'Publisher', 'SearchResult'] @@ -103,7 +103,7 @@ class Publisher(HasName): ) -class Ruleset(HasName, HasDescription): +class GameSystem(HasName, HasDescription): key = models.CharField( primary_key=True, max_length=100, diff --git a/api_v2/serializers/__init__.py b/api_v2/serializers/__init__.py index 9e384ef9..cd0f3b61 100644 --- a/api_v2/serializers/__init__.py +++ b/api_v2/serializers/__init__.py @@ -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 diff --git a/api_v2/serializers/document.py b/api_v2/serializers/document.py index 71d462fc..d326bca5 100644 --- a/api_v2/serializers/document.py +++ b/api_v2/serializers/document.py @@ -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__' diff --git a/api_v2/views/__init__.py b/api_v2/views/__init__.py index 1a069817..a22951df 100644 --- a/api_v2/views/__init__.py +++ b/api_v2/views/__init__.py @@ -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 diff --git a/api_v2/views/document.py b/api_v2/views/document.py index a5233c59..73eb3c64 100644 --- a/api_v2/views/document.py +++ b/api_v2/views/document.py @@ -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 @@ -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): diff --git a/data/v2/Ruleset.json b/data/v2/GameSystem.json similarity index 100% rename from data/v2/Ruleset.json rename to data/v2/GameSystem.json diff --git a/docs/v2/data.md b/docs/v2/data.md index ec67bd10..759160f0 100644 --- a/docs/v2/data.md +++ b/docs/v2/data.md @@ -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 diff --git a/scripts/data_manipulation/convertors/data_v2_fix_keys.py b/scripts/data_manipulation/convertors/data_v2_fix_keys.py index b83d249b..e6e5fef9 100644 --- a/scripts/data_manipulation/convertors/data_v2_fix_keys.py +++ b/scripts/data_manipulation/convertors/data_v2_fix_keys.py @@ -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: diff --git a/scripts/data_manipulation/convertors/data_v2_format_check.py b/scripts/data_manipulation/convertors/data_v2_format_check.py index 117efab4..7f8eb4b2 100644 --- a/scripts/data_manipulation/convertors/data_v2_format_check.py +++ b/scripts/data_manipulation/convertors/data_v2_format_check.py @@ -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: diff --git a/scripts/data_manipulation/convertors/v2_key_rewrite.py b/scripts/data_manipulation/convertors/v2_key_rewrite.py index 6f506e80..96bdb308 100644 --- a/scripts/data_manipulation/convertors/v2_key_rewrite.py +++ b/scripts/data_manipulation/convertors/v2_key_rewrite.py @@ -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: diff --git a/server/urls.py b/server/urls.py index 920fd5de..9b630588 100644 --- a/server/urls.py +++ b/server/urls.py @@ -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)