# Path: riv/shortcuts.py
# def render_to_rest(data):
#     return RestResponse(content=data)
# 
# def render_form_error_to_rest(form):
#     return RestResponse(form=form)


from django.shortcuts import render_to_response, get_object_or_404
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse, Http404
from django.template import RequestContext
from django.forms.models import modelformset_factory
from forms import PollForm, VoteForm
from models import Poll, Choice
from riv.shortcuts import render_to_rest, render_form_error_to_rest


def poll_index(request):
    poll_list = Poll.objects.all().order_by('-pub_date')
    if request.is_rest():

# Path: riv/shortcuts.py
# def render_to_rest(data):
#     return RestResponse(content=data)
# 
# def render_form_error_to_rest(form):
#     return RestResponse(form=form)


# Path: tests/polls/views.py
from django.shortcuts import render_to_response, get_object_or_404
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse, Http404
from django.template import RequestContext
from django.forms.models import modelformset_factory
from forms import PollForm, VoteForm
from models import Poll, Choice
from riv.shortcuts import render_to_rest, render_form_error_to_rest



def poll_index(request):
    poll_list = Poll.objects.all().order_by('-pub_date')
    if request.is_rest():

        return render_to_rest(poll_list)