November 2015
Beginner to intermediate
840 pages
26h 30m
English
createuser and createsuperuser CommandsThe createuser and createsuperuser commands are much more involved than the createtag command, but the principle is the same. In /user/management/commands/ we create a file called createuser.py for the createuser command and a file called createsuperuser.py for the createsuperuser command. In both files, we declare a Command class, which inherits from BaseCommand. Our goal is to define the add_arguments() and handle() methods.
We take this a step further and imitate the createsuperuser.py command supplied by auth. The command has two ways of working: interactively and non-interactively. If you checkout a commit in the git repo from before Chapter 22, you’ll be able to see this for yourself. To ...
Read now
Unlock full access