<small id='dtB4f'></small><noframes id='dtB4f'>

    1. <tfoot id='dtB4f'></tfoot>
    2. <i id='dtB4f'><tr id='dtB4f'><dt id='dtB4f'><q id='dtB4f'><span id='dtB4f'><b id='dtB4f'><form id='dtB4f'><ins id='dtB4f'></ins><ul id='dtB4f'></ul><sub id='dtB4f'></sub></form><legend id='dtB4f'></legend><bdo id='dtB4f'><pre id='dtB4f'><center id='dtB4f'></center></pre></bdo></b><th id='dtB4f'></th></span></q></dt></tr></i><div id='dtB4f'><tfoot id='dtB4f'></tfoot><dl id='dtB4f'><fieldset id='dtB4f'></fieldset></dl></div>
    3. <legend id='dtB4f'><style id='dtB4f'><dir id='dtB4f'><q id='dtB4f'></q></dir></style></legend>

        <bdo id='dtB4f'></bdo><ul id='dtB4f'></ul>

        在 Django 的管理员上记录活动 - Django

        时间:2023-11-08

      1. <i id='Shpzh'><tr id='Shpzh'><dt id='Shpzh'><q id='Shpzh'><span id='Shpzh'><b id='Shpzh'><form id='Shpzh'><ins id='Shpzh'></ins><ul id='Shpzh'></ul><sub id='Shpzh'></sub></form><legend id='Shpzh'></legend><bdo id='Shpzh'><pre id='Shpzh'><center id='Shpzh'></center></pre></bdo></b><th id='Shpzh'></th></span></q></dt></tr></i><div id='Shpzh'><tfoot id='Shpzh'></tfoot><dl id='Shpzh'><fieldset id='Shpzh'></fieldset></dl></div>
          <tfoot id='Shpzh'></tfoot><legend id='Shpzh'><style id='Shpzh'><dir id='Shpzh'><q id='Shpzh'></q></dir></style></legend>

              <bdo id='Shpzh'></bdo><ul id='Shpzh'></ul>

              <small id='Shpzh'></small><noframes id='Shpzh'>

                    <tbody id='Shpzh'></tbody>
                  本文介绍了在 Django 的管理员上记录活动 - Django的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  I need to track/log activity on the Django admin.

                  I know there are messages stored by admin somewhere, but I don't know how to access them in order to use them as a simple log.


                  I'm trying to track the following:

                  • User performing the action

                  • Action committed

                  • Datetime of action

                  Thanks guys.

                  解决方案

                  I had to do something similar and I used something like this:

                  from django.contrib.admin.models import LogEntry
                  
                  logs = LogEntry.objects.all() #or you can filter, etc.
                  for l in logs:
                      #perform action
                  

                  You can see all of the attributes for LogEntry, but I think the ones you are looking for are l.user, l.action_time and l.obj_repr (the name of the obj) and l.action_flag ({ 1:'Add',2:'Change',3:'Delete'}). Hope that helps!

                  这篇关于在 Django 的管理员上记录活动 - Django的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何抑制 Django 中的弃用警告? 下一篇:Django 删除未使用的媒体文件

                  相关文章

                • <small id='rrsNG'></small><noframes id='rrsNG'>

                • <tfoot id='rrsNG'></tfoot>
                    <legend id='rrsNG'><style id='rrsNG'><dir id='rrsNG'><q id='rrsNG'></q></dir></style></legend>
                    • <bdo id='rrsNG'></bdo><ul id='rrsNG'></ul>

                      <i id='rrsNG'><tr id='rrsNG'><dt id='rrsNG'><q id='rrsNG'><span id='rrsNG'><b id='rrsNG'><form id='rrsNG'><ins id='rrsNG'></ins><ul id='rrsNG'></ul><sub id='rrsNG'></sub></form><legend id='rrsNG'></legend><bdo id='rrsNG'><pre id='rrsNG'><center id='rrsNG'></center></pre></bdo></b><th id='rrsNG'></th></span></q></dt></tr></i><div id='rrsNG'><tfoot id='rrsNG'></tfoot><dl id='rrsNG'><fieldset id='rrsNG'></fieldset></dl></div>