Run custom admin command from view

前端 未结 1 744
清酒与你
清酒与你 2020-12-02 18:27

I have a custom admin command that emails out reports. It normally runs from a cron job. What I would like to do is add a button to my web app that when clicked will cause t

相关标签:
1条回答
  • 2020-12-02 18:52

    You can use call_command:

    from django.core.management import call_command
    call_command('myadmincmd')
    
    0 讨论(0)
提交回复
热议问题