{% extends 'dmcadmin/index.html' %} {% block content_header %}

Manage command

{% endblock %} {% block content_boxes %} {% endblock %} {% block content_main %}

How to add new manage command to the list

from dmcadmin.models import ManageCommandData

mcd = ManageCommandData()

mcd.add_manage_command_to_conf( 'app_name', 'cls_name', 'manage_command_name', 'description', template_media_path=None, args=[], kwargs={} )

  • template_media_path - it is a path to import file template, if you created import manage command for import data. Save it in /static/.

    Recomendation: import template file save to there:

    /static/managecommand/import_templates/your_template_file.xlsx
  • args: add optional arguments as list ['key', 'key']
  • kwargs: add optional named arguments as dict {'key':'value', 'key':'value'}

Example:

mcd.add_manage_command_to_conf( 'blog', 'post', 'blog_post_import', 'import new posts for blog', template_media_path='/static/managecommand/import_templates/new_blogs_post.xlsx', args=[], kwargs={} )

mcd.add_manage_command_to_conf( 'system', 'system', 'dumpdata', 'dump dmcadmin', args=['dmcadmin'], kwargs={'indent':4} )

After adding a new command, you need to restart the backend to see the new command on the web

{% endblock %}