Why makemigrations and migrate command are run without creating model?

Viewed 21
from django.shortcuts import render
from django.contrib.auth.forms import UserCreationForm

# Create your views here.

def homepage(request):
    return render(request,'homepage.html')

def register(request):
    if request.method == 'POST':

        fm = UserCreationForm(request.POST)
        if fm.is_valid():
            fm.save()
    fm = UserCreationForm()     
    return render(request,'register.html',{'form':fm})

def login(request):
    return render(request,'login.html')

On filling the details in the form on register URL, I am getting an error that auth.table is not there. I ran these both commands then

py manage.py makemigrations
py manage.py migrate
py manage.py createsuperuser

As a result the form details got submitted and I could see it through superuser. My question is what is the use of these commands when I did not create any model. I thought only after creating the model class, these commands are run so that table can be formed. But without creating the model class, how come details are saved on running makemigrations and migrate command ?

0 Answers
Related