24.5.1 The createtag Management Command

The goal is to create a simple management command that will create a new Tag object, as shown in Example 24.18.

Example 24.18: Shell Code

$ ./manage.py createtag "django unleashed"

Commands are stored in the commands package of the management package of apps, as shown in Example 24.19.

Example 24.19: Shell Code

$ mkdir -p organizer/management/commands $ touch organizer/management/--init--.py $ touch organizer/management/commands/--init--.py $ touch organizer/management/commands/createtag.py $ tree organizer/management/ organizer/management/ Image

Get Django Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.