(request, slug, template_name='news/detail.html',
           template_name_ajax='news/detail_ajax.html')
return render(request, template_name, context)
News item detail.

    In the template, we show the title and the body of the news item and
    links.

    :param django.http.HttpRequest request:
    :param string slug: Foo item slug.
    :param string template_name:
    :param string template_name_ajax:
    :return django.http.HttpResponse:
News item detail.
News item detail .
def detail(request, slug, template_name='news/detail.html',
           template_name_ajax='news/detail_ajax.html'):
    """News item detail.

    In the template, we show the title and the body of the news item and
    links.

    :param django.http.HttpRequest request:
    :param string slug: Foo item slug.
    :param string template_name:
    :param string template_name_ajax:
    :return django.http.HttpResponse:
    """
    layout = get_layout(as_instance=True)

    results_kwargs = {'slug': slug}

    try:
        queryset = NewsItem.objects.filter(**results_kwargs)

        item = queryset.get(**results_kwargs)
    except NewsItem.DoesNotExist:
        raise Http404

    context = {
        'layout': layout,
        'item': item
    }

    if request.is_ajax():
        template_name = template_name_ajax

    return render(request, template_name, context)
def detail ( request , slug , template_name = 'news/detail.html' , template_name_ajax = 'news/detail_ajax.html' ) : layout = get_layout ( as_instance = True ) results_kwargs = { 'slug' : slug } try : queryset = NewsItem . objects . filter ( * * results_kwargs ) item = queryset . get ( * * results_kwargs ) except NewsItem . DoesNotExist : raise Http404 context = { 'layout' : layout , 'item' : item } if request . is_ajax ( ) : template_name = template_name_ajax return render ( request , template_name , context )