evennia.web.api.views¶
Views are the functions that are called by different url endpoints. The Django Rest Framework provides collections called ‘ViewSets’, which can generate a number of views for the common CRUD operations.
-
class
evennia.web.api.views.
GeneralViewSetMixin
[source]¶ Bases:
object
Mixin for both typeclass- and non-typeclass entities.
-
class
evennia.web.api.views.
TypeclassViewSetMixin
[source]¶ Bases:
evennia.web.api.views.GeneralViewSetMixin
This mixin adds some shared functionality to each viewset of a typeclass. They all use the same permission classes and filter backend. You can override any of these in your own viewsets.
The set_atribute action is an example of a custom action added to a viewset. Based on the name of the method, it will create a default url_name (used for reversing) and url_path. The ‘pk’ argument is automatically passed to this action because it has a url path of the format <object type>/:pk/set-attribute. The get_object method is automatically set in the expected viewset classes that will inherit this, using the pk that’s passed along to retrieve the object.
-
permission_classes
= [<class 'evennia.web.api.permissions.EvenniaPermission'>]¶
-
filter_backends
= [<class 'django_filters.rest_framework.backends.DjangoFilterBackend'>]¶
-
-
class
evennia.web.api.views.
ObjectDBViewSet
(**kwargs)[source]¶ Bases:
evennia.web.api.views.TypeclassViewSetMixin
,rest_framework.viewsets.ModelViewSet
The Object is the parent for all in-game entities that have a location (rooms, exits, characters etc).
-
serializer_class
¶
-
queryset
¶
-
filterset_class
¶
-
list_serializer_class
¶
-
basename
= None¶
-
description
= None¶
-
detail
= None¶
-
name
= None¶
-
suffix
= None¶
-
-
class
evennia.web.api.views.
CharacterViewSet
(**kwargs)[source]¶ Bases:
evennia.web.api.views.ObjectDBViewSet
Characters are a type of Object commonly used as player avatars in-game.
-
queryset
¶
-
basename
= None¶
-
description
= None¶
-
detail
= None¶
-
name
= None¶
-
suffix
= None¶
-
-
class
evennia.web.api.views.
RoomViewSet
(**kwargs)[source]¶ Bases:
evennia.web.api.views.ObjectDBViewSet
Rooms indicate discrete locations in-game.
-
queryset
¶
-
basename
= None¶
-
description
= None¶
-
detail
= None¶
-
name
= None¶
-
suffix
= None¶
-
-
class
evennia.web.api.views.
ExitViewSet
(**kwargs)[source]¶ Bases:
evennia.web.api.views.ObjectDBViewSet
Exits are objects with a destination and allows for traversing from one location to another.
-
queryset
¶
-
basename
= None¶
-
description
= None¶
-
detail
= None¶
-
name
= None¶
-
suffix
= None¶
-
-
class
evennia.web.api.views.
AccountDBViewSet
(**kwargs)[source]¶ Bases:
evennia.web.api.views.TypeclassViewSetMixin
,rest_framework.viewsets.ModelViewSet
Accounts represent the players connected to the game
-
serializer_class
¶
-
queryset
¶
-
filterset_class
¶
-
list_serializer_class
¶
-
basename
= None¶
-
description
= None¶
-
detail
= None¶
-
name
= None¶
-
suffix
= None¶
-
-
class
evennia.web.api.views.
ScriptDBViewSet
(**kwargs)[source]¶ Bases:
evennia.web.api.views.TypeclassViewSetMixin
,rest_framework.viewsets.ModelViewSet
Scripts are meta-objects for storing system data, running timers etc. They have no in-game existence.
-
serializer_class
¶
-
queryset
¶
-
filterset_class
¶
-
list_serializer_class
¶
-
basename
= None¶
-
description
= None¶
-
detail
= None¶
-
name
= None¶
-
suffix
= None¶
-
-
class
evennia.web.api.views.
HelpViewSet
(**kwargs)[source]¶ Bases:
evennia.web.api.views.GeneralViewSetMixin
,rest_framework.viewsets.ModelViewSet
Database-stored help entries. Note that command auto-help and file-based help entries are not accessible this way.
-
serializer_class
¶
-
queryset
¶
-
filterset_class
¶
-
list_serializer_class
¶
-
basename
= None¶
-
description
= None¶
-
detail
= None¶
-
name
= None¶
-
suffix
= None¶
-