The error is occurring in views.py file in which when I try to import the form class I made from my forms .py file I get an error of...
Import ".forms" could not be resolved
Here is what my views.py file looks like:
from django.shortcuts import render, redirect
from .forms import RegisterForm
# Create your views here.
def register(response):
if response.method == "POST":
form = RegisterForm(response.POST)
if form.is_valid():
form.save()
return redirect("/home")
else:
form = RegisterForm()
return render(response,"register/register.html",{"form":form})
And here is my forms.py file
from django import forms
from django.contrib.auth import login, authenticate
from django.contrib.auth import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
class RegisterForm(UserCreationForm):
email = forms.EmailField()
class Meta:
model = User
fields = ["username", "email", "password1", "password2"]
Why am I getting that error/what am I missing?