evennia.web.api.filters

FilterSets allow clients to specify querystrings that will determine the data that is retrieved in GET requests. By default, Django Rest Framework uses the ‘django-filter’ package as its backend. Django-filter also has a section in its documentation specifically regarding DRF integration.

https://django-filter.readthedocs.io/en/latest/guide/rest_framework.html

evennia.web.api.filters.get_tag_query(tag_type: Optional[str, None], key: str) → django.db.models.query_utils.Q[source]

Returns a Q object for searching by tag names for typeclasses :param tag_type: The type of tag (None, ‘alias’, etc) :type tag_type: str or None :param key: The name of the tag :type key: str

Returns

A Q object that for searching by this tag type and name

class evennia.web.api.filters.TagTypeFilter(field_name=None, lookup_expr=None, *, label=None, method=None, distinct=False, exclude=False, **kwargs)[source]

Bases: django_filters.filters.CharFilter

This class lets you create different filters for tags of a specified db_tagtype.

tag_type = None
filter(qs, value)[source]
class evennia.web.api.filters.AliasFilter(field_name=None, lookup_expr=None, *, label=None, method=None, distinct=False, exclude=False, **kwargs)[source]

Bases: evennia.web.api.filters.TagTypeFilter

A filter for objects by their aliases (tags with a tagtype of ‘alias’

tag_type = 'alias'
class evennia.web.api.filters.PermissionFilter(field_name=None, lookup_expr=None, *, label=None, method=None, distinct=False, exclude=False, **kwargs)[source]

Bases: evennia.web.api.filters.TagTypeFilter

A filter for objects by their permissions (tags with a tagtype of ‘permission’

tag_type = 'permission'
class evennia.web.api.filters.BaseTypeclassFilterSet(data=None, queryset=None, *, request=None, prefix=None)[source]

Bases: django_filters.rest_framework.filterset.FilterSet

A parent class with filters for aliases and permissions

static filter_name(queryset, name, value)[source]

Filters a queryset by aliases or the key of the typeclass :param queryset: The queryset being filtered :param name: The name of the field :param value: The value passed in from GET params

Returns

The filtered queryset

base_filters = {'alias': <evennia.web.api.filters.AliasFilter object>, 'name': <django_filters.filters.CharFilter object>, 'permission': <evennia.web.api.filters.PermissionFilter object>}
declared_filters = {'alias': <evennia.web.api.filters.AliasFilter object>, 'name': <django_filters.filters.CharFilter object>, 'permission': <evennia.web.api.filters.PermissionFilter object>}
class evennia.web.api.filters.ObjectDBFilterSet(data=None, queryset=None, *, request=None, prefix=None)[source]

Bases: evennia.web.api.filters.BaseTypeclassFilterSet

This adds filters for ObjectDB instances - characters, rooms, exits, etc

class Meta[source]

Bases: object

model

alias of evennia.objects.models.ObjectDB

fields = ['db_key', 'db_typeclass_path', 'db_tags__db_key', 'db_tags__db_category', 'db_location__db_key', 'db_home__db_key', 'db_location__id', 'db_home__id']
base_filters = {'alias': <evennia.web.api.filters.AliasFilter object>, 'db_home__db_key': <django_filters.filters.CharFilter object>, 'db_home__id': <django_filters.filters.NumberFilter object>, 'db_key': <django_filters.filters.CharFilter object>, 'db_location__db_key': <django_filters.filters.CharFilter object>, 'db_location__id': <django_filters.filters.NumberFilter object>, 'db_tags__db_category': <django_filters.filters.CharFilter object>, 'db_tags__db_key': <django_filters.filters.CharFilter object>, 'db_typeclass_path': <django_filters.filters.CharFilter object>, 'name': <django_filters.filters.CharFilter object>, 'permission': <evennia.web.api.filters.PermissionFilter object>}
declared_filters = {'alias': <evennia.web.api.filters.AliasFilter object>, 'name': <django_filters.filters.CharFilter object>, 'permission': <evennia.web.api.filters.PermissionFilter object>}
class evennia.web.api.filters.AccountDBFilterSet(data=None, queryset=None, *, request=None, prefix=None)[source]

Bases: evennia.web.api.filters.BaseTypeclassFilterSet

This adds filters for Account objects

class Meta[source]

Bases: object

model

alias of evennia.accounts.models.AccountDB

fields = ['db_typeclass_path', 'db_tags__db_key', 'db_tags__db_category', 'username', 'db_is_connected', 'db_is_bot']
base_filters = {'alias': <evennia.web.api.filters.AliasFilter object>, 'db_is_bot': <django_filters.rest_framework.filters.BooleanFilter object>, 'db_is_connected': <django_filters.rest_framework.filters.BooleanFilter object>, 'db_tags__db_category': <django_filters.filters.CharFilter object>, 'db_tags__db_key': <django_filters.filters.CharFilter object>, 'db_typeclass_path': <django_filters.filters.CharFilter object>, 'name': <django_filters.filters.CharFilter object>, 'permission': <evennia.web.api.filters.PermissionFilter object>, 'username': <django_filters.filters.CharFilter object>}
declared_filters = {'alias': <evennia.web.api.filters.AliasFilter object>, 'name': <django_filters.filters.CharFilter object>, 'permission': <evennia.web.api.filters.PermissionFilter object>}
class evennia.web.api.filters.ScriptDBFilterSet(data=None, queryset=None, *, request=None, prefix=None)[source]

Bases: evennia.web.api.filters.BaseTypeclassFilterSet

This adds filters for Script objects

class Meta[source]

Bases: object

model

alias of evennia.scripts.models.ScriptDB

fields = ['db_key', 'db_typeclass_path', 'db_tags__db_key', 'db_tags__db_category', 'db_desc', 'db_obj__db_key', 'db_obj__id', 'db_account__id', 'db_account__username', 'db_is_active', 'db_persistent', 'db_interval']
base_filters = {'alias': <evennia.web.api.filters.AliasFilter object>, 'db_account__id': <django_filters.filters.NumberFilter object>, 'db_account__username': <django_filters.filters.CharFilter object>, 'db_desc': <django_filters.filters.CharFilter object>, 'db_interval': <django_filters.filters.NumberFilter object>, 'db_is_active': <django_filters.rest_framework.filters.BooleanFilter object>, 'db_key': <django_filters.filters.CharFilter object>, 'db_obj__db_key': <django_filters.filters.CharFilter object>, 'db_obj__id': <django_filters.filters.NumberFilter object>, 'db_persistent': <django_filters.rest_framework.filters.BooleanFilter object>, 'db_tags__db_category': <django_filters.filters.CharFilter object>, 'db_tags__db_key': <django_filters.filters.CharFilter object>, 'db_typeclass_path': <django_filters.filters.CharFilter object>, 'name': <django_filters.filters.CharFilter object>, 'permission': <evennia.web.api.filters.PermissionFilter object>}
declared_filters = {'alias': <evennia.web.api.filters.AliasFilter object>, 'name': <django_filters.filters.CharFilter object>, 'permission': <evennia.web.api.filters.PermissionFilter object>}
class evennia.web.api.filters.HelpFilterSet(data=None, queryset=None, *, request=None, prefix=None)[source]

Bases: django_filters.rest_framework.filterset.FilterSet

Filter for help entries

base_filters = {'alias': <evennia.web.api.filters.AliasFilter object>, 'category': <django_filters.filters.CharFilter object>, 'name': <django_filters.filters.CharFilter object>}
declared_filters = {'alias': <evennia.web.api.filters.AliasFilter object>, 'category': <django_filters.filters.CharFilter object>, 'name': <django_filters.filters.CharFilter object>}