fiction_outlines_api package¶
Submodules¶
fiction_outlines_api.apps module¶
fiction_outlines_api.exceptions module¶
Bases:
rest_framework.exceptions.APIException
Bases:
rest_framework.exceptions.APIException
fiction_outlines_api.mixins module¶
-
class
fiction_outlines_api.mixins.
MultiObjectPermissionsMixin
[source]¶ Bases:
object
API Mixin that compares
n
objects and their permissions and returns if both are valid. Objects can be referred to by key afterwards in self.object_dict. permission dict should be:{‘obj1’: {‘obj_class’: class_model, ‘lookup_url_kwarg’, ‘object_permission_required’: ‘your rules perm here’}, …}
Is it ugly, yes. Does it make doing this in view after view repeatable. Yep.
-
check_object_permissions
(request, perm, obj)[source]¶ Verifies the object permissions are valid for the current user.
Parameters: - request – The request object. The user is retrieved from here.
- perm – The permission to validate against (in :module:`rules`) format.
- obj – The object to evaluate.
Raises: PermissionDenied – when user lacks the required permission.
-
get_object_permission_queryset
(obj_class)[source]¶ Fetches the queryset for the permission object.
Parameters: obj_class – Model class of the object to retrieve. Returns: A django queryset for the class.
-
get_permission_object
(pkval, objectpermission, obj_class)[source]¶ Fetches the permission object and checks it agains the permission specified.
Parameters: - pkval – The pk value to use in the search.
- objectpermission – A permission based on the :module:`rules` format, e.g. “app_name.permission_name”
- obj_class – The class of the object we are searching for.
Returns: The found object.
-
object_class_permission_dict
= {}¶
-
-
class
fiction_outlines_api.mixins.
NodeAddMixin
[source]¶ Bases:
object
API Mixin for add_sibling and add_child commands.
Attribute fields_required_for_add: A tuple of fields that should be required in the submitted serializer in order to create the object. -
create
(request, *args, **kwargs)[source]¶ Does the final validation of submitted data and if valid proceeds with creation.
Raises: NotImplementedError – if client attempts to specify many-to-many relationship at creation.
-
fields_required_for_add
= ('description',)¶
-
perform_create
(serializer)[source]¶ The actual creation part.
Parameters: serializer – The serializer object representing the object to be created. Raises: ValidationError – if the data submitted is invalid or violates the structure of the tree. Returns: A serializer representing the created object.
-
post
(request, *args, **kwargs)[source]¶ Parses kwargs and kicks off evaluation process.
Parameters: - action – Either
add_child
oradd_sibling
. - position – If
add_sibling
this is required, and must be a value from :data:POSITIONS. If action isadd_child
this is ignored.
Raises: Http404 – if action is not a one of the two permitted options.
- action – Either
-
-
class
fiction_outlines_api.mixins.
NodeMoveMixin
[source]¶ Bases:
object
API mixin for move method for nodes.
-
get_object
(pkval)[source]¶ Fetches an individual object and verifies that the user has the appropriate permissions to move it.
Parameters: pkval – The primary key value to use in the search.
Returns: Object
Raises: - Http404 – if object cannot be found
- PermissionDenied – if user does not have the required permissions.
-
perform_move
()[source]¶ Validates the proposed move, and if valid, will manipulate the tree accordingly.
Raises: - ValidationError – if the move request violates tree structure.
- TreeUnavailable – if the DB tree is out of available nodes.
Returns: A serializer representing the updated node.
-
pos
= None¶
-
source_node
= None¶
-
target_node
= None¶
-
target_node_type_fieldname
= None¶
-
fiction_outlines_api.models module¶
All models come from fiction_outlines
so there is nothing to do here.
fiction_outlines_api.rules module¶
Rules definitions for api. We just import in the default rules from fiction_outlines.
fiction_outlines_api.serializers module¶
-
class
fiction_outlines_api.serializers.
ArcCreateSerializer
(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]¶ Bases:
rest_framework.serializers.Serializer
Serializer used for arc creation. You can’t create an Arc using it’s primary serializer.
-
class
fiction_outlines_api.serializers.
ArcElementNodeSerializer
(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]¶ Bases:
rest_framework.serializers.ModelSerializer
Serializer for ArcElementNode.
Special read-only attributes:
Attribute is_milestone: Does this element represent a milestone in the Arc
Attribute milestone_seq: If a milestone, what is the proscribed sequence where it should appear in the context of the other milestones. Attribute parent_outline: Convenience reference to the parent outline object. Attribute headline: Automatically generated from the first line of the description. -
class
Meta
[source]¶ Bases:
object
-
fields
= ('id', 'arc', 'arc_element_type', 'headline', 'description', 'story_element_node', 'assoc_characters', 'assoc_locations', 'milestone_seq', 'is_milestone', 'parent_outline')¶
-
model
¶ alias of
fiction_outlines.models.ArcElementNode
-
read_only_fields
= ('id', 'arc', 'headline', 'milestone_seq', 'is_milestone', 'parent_outline')¶
-
-
class
-
class
fiction_outlines_api.serializers.
ArcSerializer
(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]¶ Bases:
rest_framework.serializers.ModelSerializer
Serializer for Arc model.
To create an Arc, make sure to instead use the
ArcCreateSerializer
and post it tofiction_outlines_api.views.ArcCreateView
-
class
fiction_outlines_api.serializers.
CharacterInstanceSerializer
(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]¶ Bases:
rest_framework.serializers.ModelSerializer
Serializer for character instance.
-
class
Meta
[source]¶ Bases:
object
-
extra_kwargs
= {'field': {'required': False}}¶
-
field
= 'name'¶
-
fields
= ('id', 'outline', 'character', 'name', 'main_character', 'pov_character', 'protagonist', 'antagonist', 'obstacle', 'villain')¶
-
model
¶ alias of
fiction_outlines.models.CharacterInstance
-
read_only_fields
= ('id', 'outline', 'character', 'name')¶
-
-
class
-
class
fiction_outlines_api.serializers.
CharacterSerializer
(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]¶ Bases:
taggit_serializer.serializers.TaggitSerializer
,rest_framework.serializers.ModelSerializer
Serializer for Character model.
-
class
fiction_outlines_api.serializers.
LocationInstanceSerializer
(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]¶ Bases:
rest_framework.serializers.ModelSerializer
Serializer for location instance.
-
class
fiction_outlines_api.serializers.
LocationSerializer
(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]¶ Bases:
taggit_serializer.serializers.TaggitSerializer
,rest_framework.serializers.ModelSerializer
Serializer for Location model.
-
class
fiction_outlines_api.serializers.
OutlineSerializer
(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]¶ Bases:
taggit_serializer.serializers.TaggitSerializer
,rest_framework.serializers.ModelSerializer
Serializer for Outline model. Also provides
outline_structure
, which is a treebeard annotated list of story element nodes.Special read-only fields:
Attribute length_estimate: Auto calculated length (in words) based on the number of characters, locations, and arcs. Attribute arc_set: The fiction_outlines.models.Arc
objects associated with this outline.Attribute characterinstance_set: Character instances associated with this outline. Attribute locationinstance_set: Location instances associated with this outline. Attribute outline_structure: An annotated list of fiction_outlines.models.StoryElementNode
objects for visualizing the tree structure.-
class
Meta
[source]¶ Bases:
object
-
fields
= ('id', 'title', 'description', 'series', 'tags', 'length_estimate', 'arc_set', 'characterinstance_set', 'locationinstance_set', 'outline_structure')¶
-
model
¶ alias of
fiction_outlines.models.Outline
-
read_only_fields
= ('id', 'length_estimate', 'arc_set', 'characterinstance_set', 'locationinstance_set', 'outline_structure')¶
-
-
get_outline_structure
(obj)[source]¶ Retrieves all
fiction_outlines.StoryElementNode
objects associated with this outline, and returns it as an annotated list that can be serialized.Parameters: obj – The outline object this serializer represents. Returns: An annotated list for serialization or an empty list.
-
class
-
class
fiction_outlines_api.serializers.
SeriesSerializer
(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]¶ Bases:
taggit_serializer.serializers.TaggitSerializer
,rest_framework.serializers.ModelSerializer
Serializer for Series model.
-
class
fiction_outlines_api.serializers.
StoryElementNodeSerializer
(instance=None, data=<class 'rest_framework.fields.empty'>, **kwargs)[source]¶ Bases:
rest_framework.serializers.ModelSerializer
Serializer for StoryElementNode
Two special fields here:
Attribute all_characters: All characters associated with this node or its descendants. Attribute all_locations: All locations associated with this node of its descendants. -
class
Meta
[source]¶ Bases:
object
-
fields
= ('id', 'story_element_type', 'name', 'description', 'outline', 'assoc_characters', 'assoc_locations', 'all_characters', 'all_locations', 'impact_rating')¶
-
model
¶ alias of
fiction_outlines.models.StoryElementNode
-
read_only_fields
= ('all_characters', 'all_locations', 'impact_rating', 'outline', 'id')¶
-
-
class
fiction_outlines_api.urls module¶
-
fiction_outlines_api.urls.
path
(route, view, kwargs=None, name=None, *, Pattern=<class 'django.urls.resolvers.RoutePattern'>)¶
fiction_outlines_api.views module¶
-
class
fiction_outlines_api.views.
ArcCreateView
(**kwargs)[source]¶ Bases:
rest_framework_rules.mixins.PermissionRequiredMixin
,rest_framework.generics.CreateAPIView
API for creating arcs. Uses a custom serializer, as Arcs are generated via special methods inside a transaction.
Provides HTTP method:
- POST: Accepts data compatible with
fiction_outlines_api.serializers.ArcCreateSerializer
-
dispatch
(request, *args, **kwargs)[source]¶ .dispatch() is pretty much the same as Django’s regular dispatch, but with extra hooks for startup, finalize, and exception handling.
-
object_permission_required
= 'fiction_outlines.edit_outline'¶
-
permission_required
= 'fiction_outlines_api.valid_user'¶
-
serializer_class
¶ alias of
fiction_outlines_api.serializers.ArcCreateSerializer
- POST: Accepts data compatible with
-
class
fiction_outlines_api.views.
ArcDetailView
(**kwargs)[source]¶ Bases:
rest_framework_rules.mixins.PermissionRequiredMixin
,rest_framework.generics.RetrieveUpdateDestroyAPIView
API for non-create object operations for Arc model.
Provides HTTP methods:
- GET: Retrieve an individual object.
- PUT: Update the object with data compatible with a
fiction_outlines_api.serializers.ArcSerializer
- PATCH: Update the object with partial data that corresponds to keys in the serializer.
- DELETE: Delete the object.
-
get_queryset
()[source]¶ Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.
This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.
You may want to override this if you need to provide different querysets depending on the incoming request.
(Eg. return a list of items that is specific to the user)
-
lookup_url_kwarg
= 'arc'¶
-
object_permission_required
= 'fiction_outlines.view_arc'¶
-
permission_required
= 'fiction_outlines_api.valid_user'¶
-
serializer_class
¶
-
class
fiction_outlines_api.views.
ArcNodeCreateView
(**kwargs)[source]¶ Bases:
rest_framework_rules.mixins.PermissionRequiredMixin
,fiction_outlines_api.mixins.NodeAddMixin
,rest_framework.generics.CreateAPIView
API view for add_child and add_sibling. You can only create tree objects in relation to another object in the tree. See
mixins.NodeAddMixin
for more details.-
fields_required_for_add
= ('arc_element_type', 'description', 'story_element_node')¶
-
get_queryset
()[source]¶ Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.
This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.
You may want to override this if you need to provide different querysets depending on the incoming request.
(Eg. return a list of items that is specific to the user)
-
lookup_url_kwarg
= 'arcnode'¶
-
object_permission_required
= 'fiction_outlines.edit_arc_node'¶
-
permission_required
= 'fiction_outlines_api.valid_user'¶
-
serializer_class
¶ alias of
fiction_outlines_api.serializers.ArcElementNodeSerializer
-
-
class
fiction_outlines_api.views.
ArcNodeDetailView
(**kwargs)[source]¶ Bases:
rest_framework_rules.mixins.PermissionRequiredMixin
,rest_framework.generics.RetrieveUpdateDestroyAPIView
API for viewing a tree of
fiction_outlines.models.ArcElementNode
, as well as some basic updates.Provides HTTP methods:
- GET: Retrieve an individual object.
- PUT: Update the object with data compatible with a
fiction_outlines_api.serializers.ArcElementNodeSerializer
- PATCH: Update the object with partial data that corresponds to keys in the serializer.
- DELETE: Delete the object.
-
destroy
(request, *args, **kwargs)[source]¶ Destroys the object, but first checks that the element doesn’t represent either the Hook or Resolution of an Arc. These types may not be deleted unless you are deleting the whole arc.
Raises: ParseError – if the object represents the Hook or Resolution.
-
get_queryset
()[source]¶ Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.
This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.
You may want to override this if you need to provide different querysets depending on the incoming request.
(Eg. return a list of items that is specific to the user)
-
lookup_url_kwarg
= 'arcnode'¶
-
object_permission_required
= 'fiction_outlines.view_arc_node'¶
-
permission_classes
= (<class 'rest_framework.permissions.IsAuthenticated'>,)¶
-
permission_required
= 'fiction_outlines_api.valid_user'¶
-
serializer_class
¶ alias of
fiction_outlines_api.serializers.ArcElementNodeSerializer
-
class
fiction_outlines_api.views.
ArcNodeMoveView
(**kwargs)[source]¶ Bases:
rest_framework_rules.mixins.PermissionRequiredMixin
,fiction_outlines_api.mixins.NodeMoveMixin
,rest_framework.generics.GenericAPIView
View for moving arc nodes. See
mixins.NodeMoveMixin
for more details.-
get_queryset
()[source]¶ Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.
This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.
You may want to override this if you need to provide different querysets depending on the incoming request.
(Eg. return a list of items that is specific to the user)
-
object_permission_required
= 'fiction_outlines.edit_arc_node'¶
-
permission_classes
= (<class 'rest_framework.permissions.IsAuthenticated'>,)¶
-
permission_required
= 'fiction_outlines_api.valid_user'¶
-
serializer_class
¶ alias of
fiction_outlines_api.serializers.ArcElementNodeSerializer
-
target_node_type_fieldname
= 'arc_element_type'¶
-
-
class
fiction_outlines_api.views.
CharacterDetail
(**kwargs)[source]¶ Bases:
rest_framework_rules.mixins.PermissionRequiredMixin
,rest_framework.generics.RetrieveUpdateDestroyAPIView
API view for all single item character operations besides create.
Provides HTTP methods:
- GET: Retrieve an individual character record.
- PUT: Update a character with data compatible with a
fiction_outlines_api.serializers.CharacterSerializer
- PATCH: Update a character with partial data that corresponds to keys in
fiction_outlines_api.serializers.CharacterSerializer
-
get_queryset
()[source]¶ Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.
This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.
You may want to override this if you need to provide different querysets depending on the incoming request.
(Eg. return a list of items that is specific to the user)
-
lookup_url_kwarg
= 'character'¶
-
object_permission_required
= 'fiction_outlines.view_character'¶
-
perform_update
(serializer)[source]¶ Validates that if a series is specified, that the user has rights to it as well.
Raises: PermissionDenied – if the user does not have the required permissions.
-
permission_classes
= (<class 'rest_framework.permissions.IsAuthenticated'>,)¶
-
permission_required
= 'fiction_outlines_api.valid_user'¶
-
serializer_class
¶ alias of
fiction_outlines_api.serializers.CharacterSerializer
-
class
fiction_outlines_api.views.
CharacterInstanceCreateView
(**kwargs)[source]¶ Bases:
fiction_outlines_api.mixins.MultiObjectPermissionsMixin
,rest_framework_rules.mixins.PermissionRequiredMixin
,rest_framework.generics.CreateAPIView
API view for creating a character instance. Expects kwargs in url for character and outline. All other data comes from the serializer.
Provides HTTP methods:
- POST: Accepts data compatible with a
fiction_outlines_api.serializers.CharacterInstanceSerializer
-
object_class_permission_dict
= {'character': {'lookup_url_kwarg': 'character', 'obj_class': <class 'fiction_outlines.models.Character'>, 'object_permission_required': 'fiction_outlines.edit_character'}, 'outline': {'lookup_url_kwarg': 'outline', 'obj_class': <class 'fiction_outlines.models.Outline'>, 'object_permission_required': 'fiction_outlines.edit_outline'}}¶
-
perform_create
(serializer)[source]¶ Attempts the actual creation of the instance.
Raises: ParseError – if the character is already associated with the outline.
-
permission_required
= 'fiction_outlines_api.valid_user'¶
-
serializer_class
¶ alias of
fiction_outlines_api.serializers.CharacterInstanceSerializer
- POST: Accepts data compatible with a
-
class
fiction_outlines_api.views.
CharacterInstanceDetailView
(**kwargs)[source]¶ Bases:
rest_framework_rules.mixins.PermissionRequiredMixin
,rest_framework.generics.RetrieveUpdateDestroyAPIView
API view for non-creation actions on CharacterInstance objects.
Provides HTTP methods:
- GET: Retrieve an individual object.
- PUT: Update the object with data compatible with a
fiction_outlines_api.serializers.CharacterInstanceSerializer
- PATCH: Update the object with partial data that corresponds to keys in the serializer.
- DELETE: Delete the object.
-
get_queryset
()[source]¶ Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.
This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.
You may want to override this if you need to provide different querysets depending on the incoming request.
(Eg. return a list of items that is specific to the user)
-
lookup_url_kwarg
= 'instance'¶
-
object_permission_required
= 'fiction_outlines.view_character_instance'¶
-
permission_required
= 'fiction_outlines_api.valid_user'¶
-
serializer_class
¶ alias of
fiction_outlines_api.serializers.CharacterInstanceSerializer
-
class
fiction_outlines_api.views.
CharacterList
(**kwargs)[source]¶ Bases:
rest_framework.generics.ListCreateAPIView
API view for character list
Provies HTTP methods:
- GET: Retrive a list of
fiction_outlines.models.Character
objects for the current user. - POST: Create a character. Takes data compatible with
fiction_outlines_api.serializers.CharacterSerializer
-
get_queryset
()[source]¶ Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.
This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.
You may want to override this if you need to provide different querysets depending on the incoming request.
(Eg. return a list of items that is specific to the user)
-
permission_classes
= (<class 'rest_framework.permissions.IsAuthenticated'>,)¶
-
serializer_class
¶ alias of
fiction_outlines_api.serializers.CharacterSerializer
- GET: Retrive a list of
-
class
fiction_outlines_api.views.
LocationDetail
(**kwargs)[source]¶ Bases:
rest_framework_rules.mixins.PermissionRequiredMixin
,rest_framework.generics.RetrieveUpdateDestroyAPIView
API view for all single item location operations besides create.
Provides HTTP methods:
- GET: Retrieve an individual object.
- PUT: Update the object with data compatible with a
fiction_outlines_api.serializers.LocationSerializer
- PATCH: Update the object with partial data that corresponds to keys in the serializer.
- DELETE: Delete the object.
-
get_queryset
()[source]¶ Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.
This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.
You may want to override this if you need to provide different querysets depending on the incoming request.
(Eg. return a list of items that is specific to the user)
-
lookup_url_kwarg
= 'location'¶
-
object_permission_required
= 'fiction_outlines.view_location'¶
-
perform_update
(serializer)[source]¶ Performs update actions. If a series is specified, it verifies the user has rights to it as well.
Raises: PermissionDenied – if the user does not have the correct permissions.
-
permission_classes
= (<class 'rest_framework.permissions.IsAuthenticated'>,)¶
-
permission_required
= 'fiction_outlines_api.valid_user'¶
-
serializer_class
¶ alias of
fiction_outlines_api.serializers.LocationSerializer
-
class
fiction_outlines_api.views.
LocationInstanceCreateView
(**kwargs)[source]¶ Bases:
fiction_outlines_api.mixins.MultiObjectPermissionsMixin
,rest_framework_rules.mixins.PermissionRequiredMixin
,rest_framework.generics.CreateAPIView
API view for creating a location instance. Expects kwargs in url for location and outline. All other data comes from the serializer.
Provides HTTP method:
- POST: accepts data compatible with
fiction_outlines_api.serializers.LocationInstanceSerializer
-
object_class_permission_dict
= {'location': {'lookup_url_kwarg': 'location', 'obj_class': <class 'fiction_outlines.models.Location'>, 'object_permission_required': 'fiction_outlines.edit_location'}, 'outline': {'lookup_url_kwarg': 'outline', 'obj_class': <class 'fiction_outlines.models.Outline'>, 'object_permission_required': 'fiction_outlines.edit_outline'}}¶
-
perform_create
(serializer)[source]¶ Creates the location instance.
Raises: ParseError – if the location is already associated with the outline.
-
permission_required
= 'fiction_outlines_api.valid_user'¶
-
serializer_class
¶ alias of
fiction_outlines_api.serializers.LocationInstanceSerializer
- POST: accepts data compatible with
-
class
fiction_outlines_api.views.
LocationInstanceDetailView
(**kwargs)[source]¶ Bases:
rest_framework_rules.mixins.PermissionRequiredMixin
,rest_framework.generics.RetrieveDestroyAPIView
API view for non-creation actions on LocationInstance objects. As locations instances don’t have editable data, only retrieval and destroy are supported at this time.
Provides HTTP methods:
- GET: Retrieve an individual object.
- DELETE: Delete the object.
-
get_queryset
()[source]¶ Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.
This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.
You may want to override this if you need to provide different querysets depending on the incoming request.
(Eg. return a list of items that is specific to the user)
-
lookup_url_kwarg
= 'instance'¶
-
object_permission_required
= 'fiction_outlines.view_location_instance'¶
-
permission_required
= 'fiction_outlines_api.valid_user'¶
-
serializer_class
¶ alias of
fiction_outlines_api.serializers.LocationInstanceSerializer
-
class
fiction_outlines_api.views.
LocationList
(**kwargs)[source]¶ Bases:
rest_framework.generics.ListCreateAPIView
API view for location list
Provides HTTP methods:
- GET: Retrieve a list of Locations for the current user.
- POST: Create a location with data compatibile with
fiction_outlines_api.serializers.LocationSerializer
-
get_queryset
()[source]¶ Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.
This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.
You may want to override this if you need to provide different querysets depending on the incoming request.
(Eg. return a list of items that is specific to the user)
-
perform_create
(serializer)[source]¶ Creates the object. If a series is specified, verify the user has rights to it as well.
Raises: PermissionDenied – if the user lackst he required permissions.
-
permission_classes
= (<class 'rest_framework.permissions.IsAuthenticated'>,)¶
-
serializer_class
¶ alias of
fiction_outlines_api.serializers.LocationSerializer
-
class
fiction_outlines_api.views.
OutlineDetail
(**kwargs)[source]¶ Bases:
rest_framework_rules.mixins.PermissionRequiredMixin
,rest_framework.generics.RetrieveUpdateDestroyAPIView
API view for all single item outline operations besides create.
Provides HTTP methods:
- GET: Retrieve an individual object.
- PUT: Update the object with data compatible with a
fiction_outlines_api.serializers.OutlineSerializer
- PATCH: Update the object with partial data that corresponds to keys in the serializer.
- DELETE: Delete the object.
-
get_queryset
()[source]¶ Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.
This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.
You may want to override this if you need to provide different querysets depending on the incoming request.
(Eg. return a list of items that is specific to the user)
-
lookup_url_kwarg
= 'outline'¶
-
object_permission_required
= 'fiction_outlines.view_outline'¶
-
perform_update
(serializer)[source]¶ Updates the object. If a series is specified, it verifies the user has permissions for that object as well.
Raises: PermissionDenied – if the user lacks the needed permissions.
-
permission_classes
= (<class 'rest_framework.permissions.IsAuthenticated'>,)¶
-
permission_required
= 'fiction_outlines_api.valid_user'¶
-
serializer_class
¶
-
class
fiction_outlines_api.views.
OutlineList
(**kwargs)[source]¶ Bases:
rest_framework.generics.ListCreateAPIView
API view for Outline list
Provides HTTP methods:
- GET: Retrived a list of outlines for the current user.
- POST: Create a new Outline. Accepts data compatible with
fiction_outlines_api.serializers.OutlineSerializer
-
get_queryset
()[source]¶ Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.
This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.
You may want to override this if you need to provide different querysets depending on the incoming request.
(Eg. return a list of items that is specific to the user)
-
perform_create
(serializer)[source]¶ Creates the object. If a series is specified, it verfies that the user has rights to it as well.
Raises: PermissionDenied – if the user does not have the required permissions.
-
permission_classes
= (<class 'rest_framework.permissions.IsAuthenticated'>,)¶
-
serializer_class
¶
-
class
fiction_outlines_api.views.
SeriesDetail
(**kwargs)[source]¶ Bases:
rest_framework_rules.mixins.PermissionRequiredMixin
,rest_framework.generics.RetrieveUpdateDestroyAPIView
Retrieves details of a series, and enables editing of the object.
Provides HTTP methods:
- GET: retrieve the individual object.
- PUT: Update the object. Takes data compatible with a
fiction_outlines_api.serializers.SeriesSerializer
- PATCH: Update the object. Takes partial data compatible with keys from
fiction_outlines_api.serializers.SeriesSerializer
- DELETE: Delete the object.
-
get_queryset
()[source]¶ Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.
This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.
You may want to override this if you need to provide different querysets depending on the incoming request.
(Eg. return a list of items that is specific to the user)
-
lookup_url_kwarg
= 'series'¶
-
object_permission_required
= 'fiction_outlines.view_series'¶
-
permission_classes
= (<class 'rest_framework.permissions.IsAuthenticated'>,)¶
-
permission_required
= 'fiction_outlines_api.valid_user'¶
-
serializer_class
¶
-
class
fiction_outlines_api.views.
SeriesList
(**kwargs)[source]¶ Bases:
rest_framework.generics.ListCreateAPIView
API view for series list.
Provides HTTP methods:
- GET: Retrive
fiction_outlines.models.Series
objects for the current user. - POST: Accepts data compatible with a
fiction_outlines_api.serializers.SeriesSerializer
-
get_queryset
()[source]¶ Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.
This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.
You may want to override this if you need to provide different querysets depending on the incoming request.
(Eg. return a list of items that is specific to the user)
-
permission_classes
= (<class 'rest_framework.permissions.IsAuthenticated'>,)¶
-
serializer_class
¶
- GET: Retrive
-
class
fiction_outlines_api.views.
StoryNodeCreateView
(**kwargs)[source]¶ Bases:
rest_framework_rules.mixins.PermissionRequiredMixin
,fiction_outlines_api.mixins.NodeAddMixin
,rest_framework.generics.CreateAPIView
View for adding story nodes. You can only create tree elements in relation to other objects in the same tree. See
mixins.NodeAddMixin
for more details.-
fields_required_for_add
= ('story_element_type', 'name', 'description')¶
-
get_queryset
()[source]¶ Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.
This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.
You may want to override this if you need to provide different querysets depending on the incoming request.
(Eg. return a list of items that is specific to the user)
-
lookup_url_kwarg
= 'storynode'¶
-
object_permission_required
= 'fiction_outlines.edit_story_node'¶
-
permission_required
= 'fiction_outlines_api.valid_user'¶
-
serializer_class
¶ alias of
fiction_outlines_api.serializers.StoryElementNodeSerializer
-
-
class
fiction_outlines_api.views.
StoryNodeDetailView
(**kwargs)[source]¶ Bases:
rest_framework_rules.mixins.PermissionRequiredMixin
,rest_framework.generics.RetrieveUpdateDestroyAPIView
API for viewing and editing a story node.
Provides HTTP methods:
- GET: Retrieve an individual object.
- PUT: Update the object with data compatible with a
fiction_outlines_api.serializers.StoryElementNodeSerializer
- PATCH: Update the object with partial data that corresponds to keys in the serializer.
- DELETE: Delete the object.
-
get_queryset
()[source]¶ Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.
This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.
You may want to override this if you need to provide different querysets depending on the incoming request.
(Eg. return a list of items that is specific to the user)
-
lookup_url_kwarg
= 'storynode'¶
-
object_permission_required
= 'fiction_outlines.view_story_node'¶
-
permission_classes
= (<class 'rest_framework.permissions.IsAuthenticated'>,)¶
-
permission_required
= 'fiction_outlines_api.valid_user'¶
-
serializer_class
¶ alias of
fiction_outlines_api.serializers.StoryElementNodeSerializer
-
class
fiction_outlines_api.views.
StoryNodeMoveView
(**kwargs)[source]¶ Bases:
rest_framework_rules.mixins.PermissionRequiredMixin
,fiction_outlines_api.mixins.NodeMoveMixin
,rest_framework.generics.GenericAPIView
View for moving story nodes. See
mixins.NodeMoveMixin
for more details.-
get_queryset
()[source]¶ Get the list of items for this view. This must be an iterable, and may be a queryset. Defaults to using self.queryset.
This method should always be used rather than accessing self.queryset directly, as self.queryset gets evaluated only once, and those results are cached for all subsequent requests.
You may want to override this if you need to provide different querysets depending on the incoming request.
(Eg. return a list of items that is specific to the user)
-
object_permission_required
= 'fiction_outlines.edit_story_node'¶
-
permission_required
= 'fiction_outlines_api.valid_user'¶
-
serializer_class
¶ alias of
fiction_outlines_api.serializers.StoryElementNodeSerializer
-
target_node_type_fieldname
= 'story_element_type'¶
-