内射老阿姨1区2区3区4区_久久精品人人做人人爽电影蜜月_久久国产精品亚洲77777_99精品又大又爽又粗少妇毛片

djangoajaxjson的實例代碼-創(chuàng)新互聯(lián)

1. views.py

創(chuàng)新互聯(lián)公司,為您提供網(wǎng)站建設、成都網(wǎng)站制作、網(wǎng)站營銷推廣、網(wǎng)站開發(fā)設計,對服務攪拌罐車等多個行業(yè)擁有豐富的網(wǎng)站建設及推廣經(jīng)驗。創(chuàng)新互聯(lián)公司網(wǎng)站建設公司成立于2013年,提供專業(yè)網(wǎng)站制作報價服務,我們深知市場的競爭激烈,認真對待每位客戶,為客戶提供賞心悅目的作品。 與客戶共同發(fā)展進步,是我們永遠的責任!

定義views視圖函數(shù),將數(shù)據(jù)存入字典。并用壓縮為json格式,dumps,并return。

import json
def get_comments(request, article_id):
 article_obj = models.Article.objects.get(id=article_id)
 article_comments = article_obj.comment_set.select_related()
 comment_dict = {}
 for i in article_comments:
 print('comments_id', i.id)
 print('article_id', i.article_id)
 print('parent_comment_id', i.parent_comment_id)
 print('comment_type', i.comment_type)
 print('user_id', i.user_id)
 print('user_name', i.user.name)
 print('comment', i.comment)
 print('date', type(i.date))
 print('date', time.strftime("%Y-%m-%d %H:%M:%S", i.date.timetuple()))
 comment_dict[i.id] = [i.comment_type, i.comment, time.strftime("%Y-%m-%d %H:%M:%S", i.date.timetuple()), i.article_id, i.user_id, i.user.name, i.parent_comment_id]
 comment_json = json.dumps(comment_dict)
 return HttpResponse(comment_json)

網(wǎng)站題目:djangoajaxjson的實例代碼-創(chuàng)新互聯(lián)
瀏覽路徑:http://m.rwnh.cn/article32/dggepc.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供響應式網(wǎng)站網(wǎng)站維護、建站公司、域名注冊、服務器托管動態(tài)網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

商城網(wǎng)站建設
常山县| 金溪县| 东阿县| 克什克腾旗| 宣恩县| 双辽市| 金山区| 额济纳旗| 长垣县| 即墨市| 封开县| 永川市| 庆元县| 达尔| 杂多县| 三河市| 湖南省| 西宁市| 云阳县| 原阳县| 惠州市| 连山| 五峰| 永川市| 米泉市| 永登县| 南乐县| 商水县| 清涧县| 建瓯市| 高陵县| 贵德县| 诸暨市| 信丰县| 修文县| 和平县| 肥西县| 百色市| 镇沅| 焉耆| 偏关县|