evennia.web.website.views.characters

Views for manipulating Characters (children of Objects often used for puppeting).

class evennia.web.website.views.characters.CharacterMixin[source]

Bases: evennia.web.website.views.mixins.TypeclassMixin

This is a “mixin”, a modifier of sorts.

Any view class with this in its inheritance list will be modified to work with Character objects instead of generic Objects or otherwise.

model

alias of evennia.objects.objects.DefaultCharacter

form_class

alias of evennia.web.website.forms.CharacterForm

success_url
get_queryset()[source]

This method will override the Django get_queryset method to only return a list of characters associated with the current authenticated user.

Returns

queryset (QuerySet) – Django queryset for use in the given view.

class evennia.web.website.views.characters.CharacterListView(**kwargs)[source]

Bases: django.contrib.auth.mixins.LoginRequiredMixin, evennia.web.website.views.characters.CharacterMixin, django.views.generic.list.ListView

This view provides a mechanism by which a logged-in player can view a list of all other characters.

This view requires authentication by default as a nominal effort to prevent human stalkers and automated bots/scrapers from harvesting data on your users.

template_name = 'website/character_list.html'
paginate_by = 100
page_title = 'Character List'
access_type = 'view'
get_queryset()[source]

This method will override the Django get_queryset method to return a list of all characters (filtered/sorted) instead of just those limited to the account.

Returns

queryset (QuerySet) – Django queryset for use in the given view.

class evennia.web.website.views.characters.CharacterPuppetView(**kwargs)[source]

Bases: django.contrib.auth.mixins.LoginRequiredMixin, evennia.web.website.views.characters.CharacterMixin, django.views.generic.base.RedirectView, evennia.web.website.views.objects.ObjectDetailView

This view provides a mechanism by which a logged-in player can “puppet” one of their characters within the context of the website.

It also ensures that any user attempting to puppet something is logged in, and that their intended puppet is one that they own.

get_redirect_url(*args, **kwargs)[source]

Django hook.

This view returns the URL to which the user should be redirected after a passed or failed puppet attempt.

Returns

url (str) – Path to post-puppet destination.

class evennia.web.website.views.characters.CharacterManageView(**kwargs)[source]

Bases: django.contrib.auth.mixins.LoginRequiredMixin, evennia.web.website.views.characters.CharacterMixin, django.views.generic.list.ListView

This view provides a mechanism by which a logged-in player can browse, edit, or delete their own characters.

paginate_by = 10
template_name = 'website/character_manage_list.html'
page_title = 'Manage Characters'
class evennia.web.website.views.characters.CharacterUpdateView(**kwargs)[source]

Bases: evennia.web.website.views.characters.CharacterMixin, evennia.web.website.views.objects.ObjectUpdateView

This view provides a mechanism by which a logged-in player (enforced by ObjectUpdateView) can edit the attributes of a character they own.

form_class

alias of evennia.web.website.forms.CharacterUpdateForm

template_name = 'website/character_form.html'
class evennia.web.website.views.characters.CharacterDetailView(**kwargs)[source]

Bases: evennia.web.website.views.characters.CharacterMixin, evennia.web.website.views.objects.ObjectDetailView

This view provides a mechanism by which a user can view the attributes of a character, owned by them or not.

template_name = 'website/object_detail.html'
attributes = ['name', 'desc']
access_type = 'view'
get_queryset()[source]

This method will override the Django get_queryset method to return a list of all characters the user may access.

Returns

queryset (QuerySet) – Django queryset for use in the given view.

class evennia.web.website.views.characters.CharacterDeleteView(*args, **kwargs)[source]

Bases: evennia.web.website.views.characters.CharacterMixin, evennia.web.website.views.objects.ObjectDeleteView

This view provides a mechanism by which a logged-in player (enforced by ObjectDeleteView) can delete a character they own.

form_class

alias of evennia.web.website.forms.EvenniaForm

class evennia.web.website.views.characters.CharacterCreateView(**kwargs)[source]

Bases: evennia.web.website.views.characters.CharacterMixin, evennia.web.website.views.objects.ObjectCreateView

This view provides a mechanism by which a logged-in player (enforced by ObjectCreateView) can create a new character.

template_name = 'website/character_form.html'
form_valid(form)[source]

Django hook, modified for Evennia.

This hook is called after a valid form is submitted.

When an character creation form is submitted and the data is deemed valid, proceeds with creating the Character object.