Ich muss die 's handle
Methode in Django Command
Klasse überschreiben.Wie überschreibt man den Befehl von Django manage.py korrekt?
I erstellt myapp \ management \ Befehle \ createsuperuser.py:
import getpass
import sys
import django.contrib.auth.management.commands.createsuperuser as makesuperuser
from django.contrib.auth.management import get_default_username
from django.contrib.auth.password_validation import validate_password
from django.core import exceptions
from django.core.management.base import CommandError
from django.utils.encoding import force_str
from django.utils.text import capfirst
class Command(makesuperuser.Command):
def handle(self, *args, **options):
# the rest of code is copied from Django source and is almost
# standart except few changes related to how info of
# REQUIRED_FIELDS is shown
Wenn ich in Terminal ./manage.py createsuperuser
sehe ich keine Änderungen. Wenn ich den Namen meiner Datei ändere, sagen wir mycmd.py
und tun ./manage.py mycmd
alles beginnt zu arbeiten, wie ich es erwarte.
Wie bekomme ich Änderungen, die ich brauche mit ./manage.py createsuperuser
?