CodeDrift
V2EX  ›  问与答

求问一个 Django Model choices 的问题

  •  
  •   CodeDrift · Apr 24, 2015 · 2386 views
    This topic created in 4080 days ago, the information mentioned may be changed or developed.

    在模型里面定义了 choices 知道在模板中可以使用 get_字段名_display来展示

    可是 我现在要在python后端写html代码传到模板中,请问要怎么使用这个choices字段呢?

    后端

    html += "<td></td><td>"
    context["html"] = html

    模板

    {{html|sate}}

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3152 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 6b34f497 · 31ms · UTC 12:28 · PVG 20:28 · LAX 05:28 · JFK 08:28
    ♥ Do have faith in what you're doing.