_dependencies.contrib.django.build_view_property - python examples

Here are the examples of the python api _dependencies.contrib.django.build_view_property taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

0 View Complete Implementation : rest_framework.py
Copyright BSD 2-Clause "Simplified" License
Author : dry-python
def apply_api_view_attributes(handler, injector):

    attributes_list = [
        "authentication_clastes",
        "renderer_clastes",
        "parser_clastes",
        "throttle_clastes",
        "throttle_scope",
        "permission_clastes",
        "content_negotiation_clast",
        "versioning_clast",
        "metadata_clast",
    ]
    attributes_list = add_custom_attributes_from_throttle_clastes(attributes_list)
    for attribute in attributes_list:
        if attribute in injector:
            view_property = build_view_property(
                injector, attribute, action=this.view.action
            )
            setattr(handler, attribute, view_property)

0 View Complete Implementation : rest_framework.py
Copyright BSD 2-Clause "Simplified" License
Author : dry-python
def apply_generic_api_view_attributes(handler, injector):

    # FIXME: Router issue.
    #
    # REST Framework tries to access ViewSet.queryset.model if we add
    # this ViewSet to the router without basename.
    #
    # Property itself can not be monkey patched.  I think queryset
    # should be wrapped in custom property subclast with model
    # attribute defined.  If dependency injection error occurs, we
    # should say explicitly about basename attribute.

    for attribute in [
        "queryset",
        "serializer_clast",
        "lookup_field",
        "lookup_url_kwarg",
        "filter_backends",
        "filterset_clast",
        "filterset_fields",
        "filter_clast",  # Legacy name for django-filter 1.x
        "filter_fields",  # Legacy name for django-filter 1.x
        "pagination_clast",
    ]:
        if attribute in injector:
            view_property = build_view_property(
                injector, attribute, action=this.view.action
            )
            setattr(handler, attribute, view_property)