django cannot fix integrity error
<p>I've decided to drop a row from a field from a database i'm setting up in django. I've deleted it in models/form and completely re-ran the database (makemigrations, migrate). However, no matter what I do i keep getting an integrity error (NOT NULL constraint failed: index_user.email). I'm not sure why i'm getting this, as the field doesn't even exist anymore and I cant find any trace of it in any files. Anyone know how to solve this error?</p>

<p>models: </p>

<pre><code>from django.db import models

# Create your models here.

class user(models.Model):
    username = models.CharField(max_length=20)
    password = models.CharField(max_length=15)

    def __str__(self):
        return self.username + ' - ' + self.password
</code></pre>

<p>views: </p>

<pre><code>def login(request):
    form = LoginForm(request.POST)
    if form.is_valid():
         username = form.cleaned_data["username"]
         password = form.cleaned_data["password"]
         user = authenticate(username=username, password=password)

         if user is not None:
            if user.is_active:
                login(request, user)
                return redirect('loggedin.html')
            else:
                return HttpResponse("Account deleted or disabled")
         else:
            return HttpResponseRedirect('/invalid')

    return render(request, "login_page.html", {'form': form})
</code></pre>

<p>form:</p>

<pre><code>class LoginForm(forms.Form):
    username = forms.CharField()
    password = forms.CharField(widget=forms.PasswordInput)

def clean(self, *args, **kwargs):
    username = self.cleaned_data.get("username")
    password = self.cleaned_data.get("password")
    if username and password:
        user = authenticate(username=username, password=password)
        if not user:
            raise forms.ValidationError("User does not exist.")
        if not user.is_active:
            raise forms.ValidationError("User is no longer active.")
    return super(UserLoginForm, self).clean(*args, **kwargs)
</code></pre>

<p>you can run a fake migrations. It will let you by pass the error for now. Also try to delete your migrations first, if that does not work see if the below works. </p>

<p>python manage.py makemigrations
python manage.py migrate --fake</p>

python django integrity