Skip to main content
Help us improve Python packaging – donate today!

Django Dict Response

Project Description

Overview

Write views.py simply.

Usage

Before:

from django.shortcuts import redirect, render

def view(request):
    ...
    if request.method == 'POST':
        ...
        return redirect(url)
    response = render(request, template_name, dict(obj=obj, title=title), status=200)
    response['Age'] = 120
    return response

After:

def view(request):
    ...
    if request.method == 'POST':
        ...
        return {'redirect_to': [url]}
    return dict(Age=120, obj=obj, template_name=template_name, title=title, status=200)

Installation

  1. Install using pip:

    pip install -U django-dict-response

  2. Add to last of MIDDLEWARE_CLASSES in your settings.py:

    'django_dict_response.middlewares.DictResponseMiddleware',

Dependencies

Django >= 1.7

Configuration

  • REDIRECT_KEY

    The setting is used when redirect
    default: 'redirect_to'

Release history Release notifications

This version
History Node

0.0.8

History Node

0.0.7

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
django-dict-response-0.0.8.tar.gz (2.5 kB) Copy SHA256 hash SHA256 Source None Apr 19, 2015

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page