From b613064da86dd9f4b67c02c4b0c48839aa968106 Mon Sep 17 00:00:00 2001 From: Steven Noto Date: Thu, 26 Feb 2026 00:25:07 -0600 Subject: [PATCH] Added filter on monsters for environments --- README.md | 2 +- api/filters.py | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 60f716604..e1e87789f 100644 --- a/README.md +++ b/README.md @@ -117,7 +117,7 @@ pipenv run python manage.py spectacular --color --file openapi-schema.yml` to bu ``` # Contributing -See [contribution guide](CONTRIBUTING.md). +See [contribution guide](.github/CONTRIBUTING.md). # Tests Tests are located in the `api/tests` directory. These should be run before pushing new changes to the main repository. These tests require that the api is [running](##run) at `http://localhost:8000`. diff --git a/api/filters.py b/api/filters.py index 7731784e7..38a5c67b2 100644 --- a/api/filters.py +++ b/api/filters.py @@ -76,6 +76,10 @@ class Meta: class MonsterFilter(CommonFilterSet): + environments = django_filters.CharFilter( + field_name="environments_json", lookup_expr="icontains" + ) + class Meta: model = models.Monster fields = { @@ -91,6 +95,7 @@ class Meta: "hit_points": ["exact", "range", "gt", "gte", "lt", "lte"], "armor_class": ["exact", "range", "gt", "gte", "lt", "lte"], "type": ["iexact", "exact", "in", "icontains"], + "environments_json": ["iexact", "exact", "in", "icontains"], "size": ["iexact", "exact", "in", "icontains"], "page_no": ["exact", "range", "gt", "gte", "lt", "lte"], "document__slug": [