Beispiel #1
0
    def get_object(self, queryset=None):
        urld = get_flatpage_url_dict()
        try:
            page_id = urld[self.kwargs['url']]
        except:
            raise Http404()

        return get_flatpage_by_id(page_id)
Beispiel #2
0
def detail_flatpage_view(request, url):
    url_dict = get_flatpage_url_dict()
    try:
        page_id = url_dict[url]
    except:
        raise Http404()
    flatpage = get_flatpage_by_id(page_id)

    t = get_detail_flatpage_template(flatpage)

    return HttpResponse(t.get_html(request))
Beispiel #3
0
def detail_flatpage_view(request, url):
    print(url)
    if not url:
        return JsonFailResponse({'msg': '缺少必要参数'})
    urld = get_flatpage_url_dict()
    try:
        page_id = urld[url]
    except:
        return JsonFailResponse({'code': 404, 'msg': '404'})

    flatpage = get_flatpage_by_id(page_id)
    if not flatpage:
        return JsonFailResponse({'code': 404, 'msg': '404'})

    return JsonSuccessResponse({'flatpage': flatpage_to_dict(flatpage)})