• 回复和评论的动态添加


    views.py

    t = get_template('reply_item.html')
    html = t.render(template.Context({'i':answer,'user':user}))
    ret={'status':'succeed','error':answer.id,'html':html}

    js

                                $("#ask_table").append(data.html);

    html

    <tr >
    <td align="left" width="65px" valign="top" style="padding:10px 0px 0px 10px;">
    <a href="/profile/profileview/{{ i.user.get_profile.id }}">
    <img class="smallImage imgborder" src="/site_media/{{ i.user.get_profile.profile_picture }}"/></a>
    <span style="display:block; margin:10px 0px 0px 0px; "><a class="smallA" href="/profile/profileview/{{ i.user.id }}">{{i.user}}</a></span>
    <span style="display:block; margin:10px 0px 0px 0px;">Title</span>
    <span style="display:block; margin:10px 0px 0px 0px;">{{i.time|date:"F,j,Y"}}</span></td>
    <td valign="top" width="50px">
    {%if not question.is_solve%}
    {%ifequal question.user user%}
    <a class="makedeal" id="makedeal{{ i.id }}" data="ask_makedeal">Deal</a></td>
    {%endifequal%}

    {% else %}
    {% if i.is_succeed %}
    <a class="imageA" id="makedeal{{ i.id }}" data="ask_makedeal">
    <img style="margin:20px 0px 0px 0px;" src="/site_media/photos/solved.gif"/></a></td>
    {% endif %}
    {%endif%}

    <td width="600px" valign="top">
    <p class="contentP">{{i.content}}
    {% ifequal i.user user %}
    <a class="change_answer smallA"><i>edit</i></a>
    {% endifequal %}

    </p>
    {% ifequal i.user user %}
    {% endifequal %}
    <p align="left">{% if i.attach %}
    <span><strong>Attachment:</strong><a class="smallA preview" id="answer_attach" href="/site_media/{{i.attach}}">{{i.attach}}</a></span>
    {% endif %}</p>
    <span style="float:right;">
    <a id="ask_disagree_{{ i.id }}" class="button1 button18 width150" num="{{ i.dislike_number }}" data="ask_disagree">
    <img src="/site_static/images/disagree.png"> DisAgree| <span class="fontgray">{{ i.dislike_number }}</span></a>
    </span>
    <span style="float:right;"><a id="ask_agree_{{ i.id }}" class="button1 button18 width130" num="{{ i.like_number }}" data="ask_agree">
    <img src="/site_static/images/agree.png"> Agree| <span class="fontgray">{{ i.like_number }}</span></a>
    </span>
    <span style="float:right;"><a id="ask_comment_{{ i.id }}" class="button1 button18 width100" num="{{ i.comment_count }}" data="ask_comment">
    <img src="/site_static/images/reply1.png"> Reply | <span class="fontgray">{{ i.comment_count }}</span></a></span>
    <form id="comment_{{ i.id }}_form" action="/questions/add_comment/{{ i.id }}" method="post">
    <div id="relpyP_{{ i.id }}" class="replyP">
    <div id="commentD_{{ i.id }}"></div>
    <textarea id="textarea_{{ i.id }}" name="content" class="text textarea1" rows="" cols=""></textarea>
    <input id="comment_{{ i.id }}" type="button" class="button1 button11" value="post" data="comment_post">

    </div></form>
    </td>
    </tr>

  • 相关阅读:
    SQL 索引
    SQL 存储
    C#编程中的66个好习惯,你有多少个?
    Delphi中如何让窗口最小化至系统托盘
    浅谈 堆和堆栈
    C#编程中的66个好习惯
    用ADO连接oracle的步骤
    如何卸载ocx包
    数据库中,Decimal数据类型
    [转载]内存区划分、内存分配、常量存储区、堆、栈、自由存储区、全局区
  • 原文地址:https://www.cnblogs.com/lddhbu/p/2675965.html
Copyright © 2020-2023  润新知