Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/staging' into 364-v2-testing
Browse files Browse the repository at this point in the history
  • Loading branch information
augustjohnson committed Oct 8, 2024
2 parents cb3eca3 + d8ffa55 commit f74994d
Show file tree
Hide file tree
Showing 52 changed files with 79 additions and 79 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 gamesystem the source is associated with. Select one of the available gamesystems. If the gamesystem 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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<p align="center">
<a href="https://open5e.com">https://open5e.com</a>
<br/>
A JSON API for the D&D 5e ruleset
A JSON API for the D&D 5e gamesystem
</p>
</p>
<br />
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
12 changes: 6 additions & 6 deletions api_v2/management/commands/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ def handle(self, *args, **options) -> None:
self.stdout.write(self.style.SUCCESS('Data for v1 data complete.'))

# Start V2 output.
rulesets = Ruleset.objects.all()
ruleset_path = get_filepath_by_model(
'Ruleset',
gamesystems = GameSystem.objects.all()
gamesystem_path = get_filepath_by_model(
'GameSystem',
'api_v2',
base_path=options['dir'],
format=options['format'])
write_queryset_data(ruleset_path, rulesets, format=options['format'])
write_queryset_data(gamesystem_path, gamesystems, format=options['format'])

license_path = get_filepath_by_model(
'License',
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
8 changes: 4 additions & 4 deletions api_v2/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ 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.')),
('key', models.CharField(help_text='Unique key for the ruleset the document was published for.', max_length=100, primary_key=True, serialize=False)),
('key', models.CharField(help_text='Unique key for the gamesystem the document was published for.', max_length=100, primary_key=True, serialize=False)),
('content_prefix', models.CharField(blank=True, help_text='Short code prepended to content keys.', max_length=10)),
],
options={
Expand Down Expand Up @@ -533,8 +533,8 @@ class Migration(migrations.Migration):
),
migrations.AddField(
model_name='document',
name='ruleset',
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'),
name='gamesystem',
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'),
),
migrations.CreateModel(
name='Size',
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
2 changes: 1 addition & 1 deletion api_v2/models/creature.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class CreatureType(HasName, HasDescription, FromDocument):

class Creature(Object, HasAbilities, HasSenses, HasLanguage, HasSpeed, FromDocument):
"""
This is the model for a Creature, per the 5e ruleset.
This is the model for a Creature, per the 5e gamesystem.
This extends the object and abilities models.
"""
Expand Down
10 changes: 5 additions & 5 deletions api_v2/models/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ class Document(HasName, HasDescription):
on_delete=models.CASCADE,
help_text="Publisher which has written the game content document.")

ruleset = models.ForeignKey(
"Ruleset",
gamesystem = models.ForeignKey(
"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,11 +103,11 @@ class Publisher(HasName):
)


class Ruleset(HasName, HasDescription):
class GameSystem(HasName, HasDescription):
key = models.CharField(
primary_key=True,
max_length=100,
help_text="Unique key for the ruleset the document was published for."
help_text="Unique key for the gamesystem the document was published for."
)

content_prefix = models.CharField(
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/tests/test_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def test_get_root_list(self):
self.assertContains(response, 'documents', count=2)
self.assertContains(response, 'publishers', count=2)
self.assertContains(response, 'licenses', count=2)
self.assertContains(response, 'rulesets', count=2)
self.assertContains(response, 'gamesystems', count=2)
self.assertContains(response, 'items', count=4) #include itemsets
self.assertContains(response, 'itemsets', count=2)
self.assertContains(response, 'weapons', count=2)
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
4 changes: 2 additions & 2 deletions api_v2/views/ability.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Meta:
'key': ['in', 'iexact', 'exact' ],
'name': ['iexact', 'exact','contains'],
'document__key': ['in','iexact','exact'],
'document__ruleset__key': ['in','iexact','exact'],
'document__gamesystem__key': ['in','iexact','exact'],
}

class AbilityViewSet(viewsets.ReadOnlyModelViewSet):
Expand All @@ -33,7 +33,7 @@ class Meta:
'key': ['in', 'iexact', 'exact' ],
'name': ['iexact', 'exact','contains'],
'document__key': ['in','iexact','exact'],
'document__ruleset__key': ['in','iexact','exact'],
'document__gamesystem__key': ['in','iexact','exact'],
}


Expand Down
2 changes: 1 addition & 1 deletion api_v2/views/alignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Meta:
'key': ['in', 'iexact', 'exact' ],
'name': ['iexact', 'exact','contains'],
'document__key': ['in','iexact','exact'],
'document__ruleset__key': ['in','iexact','exact'],
'document__gamesystem__key': ['in','iexact','exact'],
}

class AlignmentViewSet(viewsets.ReadOnlyModelViewSet):
Expand Down
2 changes: 1 addition & 1 deletion api_v2/views/background.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Meta:
'key': ['in', 'iexact', 'exact'],
'name': ['iexact', 'exact'],
'document__key': ['in', 'iexact', 'exact'],
'document__ruleset__key': ['in','iexact','exact'],
'document__gamesystem__key': ['in','iexact','exact'],
}


Expand Down
2 changes: 1 addition & 1 deletion api_v2/views/characterclass.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Meta:
'key': ['in', 'iexact', 'exact' ],
'name': ['iexact', 'exact','contains'],
'document__key': ['in','iexact','exact'],
'document__ruleset__key': ['in','iexact','exact'],
'document__gamesystem__key': ['in','iexact','exact'],
'subclass_of': ['exact']
}

Expand Down
2 changes: 1 addition & 1 deletion api_v2/views/condition.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Meta:
'key': ['in', 'iexact', 'exact' ],
'name': ['iexact', 'exact','contains'],
'document__key': ['in','iexact','exact'],
'document__ruleset__key': ['in','iexact','exact'],
'document__gamesystem__key': ['in','iexact','exact'],
}


Expand Down
6 changes: 3 additions & 3 deletions api_v2/views/creature.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Meta:
'key': ['in', 'iexact', 'exact' ],
'name': ['iexact', 'exact', 'icontains'],
'document__key': ['in','iexact','exact'],
'document__ruleset__key': ['in','iexact','exact'],
'document__gamesystem__key': ['in','iexact','exact'],
'size': ['exact'],
'category': ['exact', 'iexact'],
'subcategory': ['exact', 'iexact'],
Expand Down Expand Up @@ -73,7 +73,7 @@ class Meta:
'key': ['in', 'iexact', 'exact' ],
'name': ['iexact', 'exact','contains'],
'document__key': ['in','iexact','exact'],
'document__ruleset__key': ['in','iexact','exact'],
'document__gamesystem__key': ['in','iexact','exact'],
}


Expand All @@ -94,7 +94,7 @@ class Meta:
'key': ['in', 'iexact', 'exact' ],
'name': ['iexact', 'exact','contains'],
'document__key': ['in','iexact','exact'],
'document__ruleset__key': ['in','iexact','exact'],
'document__gamesystem__key': ['in','iexact','exact'],
}


Expand Down
2 changes: 1 addition & 1 deletion api_v2/views/damagetype.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Meta:
'key': ['in', 'iexact', 'exact' ],
'name': ['iexact', 'exact','contains'],
'document__key': ['in','iexact','exact'],
'document__ruleset__key': ['in','iexact','exact'],
'document__gamesystem__key': ['in','iexact','exact'],
}


Expand Down
12 changes: 6 additions & 6 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.
list: API Endpoint for returning a set of gamesystems.
retrieve: API endpoint for return a particular ruleset.
retrieve: API endpoint for return a particular gamesystem.
"""
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
2 changes: 1 addition & 1 deletion api_v2/views/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Meta:
'key': ['in', 'iexact', 'exact' ],
'name': ['iexact', 'exact','contains'],
'document__key': ['in','iexact','exact'],
'document__ruleset__key': ['in','iexact','exact'],
'document__gamesystem__key': ['in','iexact','exact'],
}


Expand Down
2 changes: 1 addition & 1 deletion api_v2/views/feat.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Meta:
'key': ['in', 'iexact', 'exact' ],
'name': ['iexact', 'exact'],
'document__key': ['in','iexact','exact'],
'document__ruleset__key': ['in','iexact','exact'],
'document__gamesystem__key': ['in','iexact','exact'],
}


Expand Down
8 changes: 4 additions & 4 deletions api_v2/views/item.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Meta:
'requires_attunement': ['exact'],
'category': ['in', 'exact'],
'document__key': ['in','iexact','exact'],
'document__ruleset__key': ['in','iexact','exact'],
'document__gamesystem__key': ['in','iexact','exact'],
}


Expand Down Expand Up @@ -56,7 +56,7 @@ class Meta:
'key': ['in', 'iexact', 'exact' ],
'name': ['iexact', 'exact'],
'document__key': ['in','iexact','exact'],
'document__ruleset__key': ['in','iexact','exact'],
'document__gamesystem__key': ['in','iexact','exact'],
}


Expand Down Expand Up @@ -89,7 +89,7 @@ class Meta:
'key': ['in', 'iexact', 'exact' ],
'name': ['iexact', 'exact'],
'document__key': ['in','iexact','exact'],
'document__ruleset__key': ['in','iexact','exact'],
'document__gamesystem__key': ['in','iexact','exact'],
'damage_dice': ['in','iexact','exact'],
'versatile_dice': ['in','iexact','exact'],
'range_reach': ['exact','lt','lte','gt','gte'],
Expand Down Expand Up @@ -127,7 +127,7 @@ class Meta:
'key': ['in', 'iexact', 'exact' ],
'name': ['iexact', 'exact'],
'document__key': ['in','iexact','exact'],
'document__ruleset__key': ['in','iexact','exact'],
'document__gamesystem__key': ['in','iexact','exact'],
'grants_stealth_disadvantage': ['exact'],
'strength_score_required': ['exact','lt','lte','gt','gte'],
'ac_base': ['exact','lt','lte','gt','gte'],
Expand Down
2 changes: 1 addition & 1 deletion api_v2/views/language.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Meta:
'key': ['in', 'iexact', 'exact' ],
'name': ['iexact', 'exact'],
'document__key': ['in','iexact','exact'],
'document__ruleset__key': ['in','iexact','exact'],
'document__gamesystem__key': ['in','iexact','exact'],
'is_exotic': ['exact'],
'is_secret': ['exact']
}
Expand Down
2 changes: 1 addition & 1 deletion api_v2/views/race.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Meta:
'key': ['in', 'iexact', 'exact'],
'name': ['iexact', 'exact'],
'document__key': ['in', 'iexact', 'exact'],
'document__ruleset__key': ['in','iexact','exact'],
'document__gamesystem__key': ['in','iexact','exact'],
'subrace_of': ['isnull'],
'subrace_of__key':['in', 'iexact', 'exact'],
}
Expand Down
2 changes: 1 addition & 1 deletion api_v2/views/size.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Meta:
'key': ['in', 'iexact', 'exact' ],
'name': ['iexact', 'exact','contains'],
'document__key': ['in','iexact','exact'],
'document__ruleset__key': ['in','iexact','exact'],
'document__gamesystem__key': ['in','iexact','exact'],
}


Expand Down
2 changes: 1 addition & 1 deletion api_v2/views/spell.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Meta:
'key': ['in', 'iexact', 'exact'],
'name': ['iexact', 'exact', 'contains', 'icontains'],
'document__key': ['in', 'iexact', 'exact'],
'document__ruleset__key': ['in', 'iexact', 'exact'],
'document__gamesystem__key': ['in', 'iexact', 'exact'],
'classes__key': ['in', 'iexact', 'exact'],
'classes__name': ['in'],
'level': ['exact', 'range', 'gt', 'gte', 'lt', 'lte'],
Expand Down
Loading

0 comments on commit f74994d

Please sign in to comment.