I am trying to change my user model to a custom one. I do not mind dropping my database and just using a new one, but when I try it to run makemigrations i get this error
bookings.Session.session_client: (fields.E301) Field defines a relation with the model 'auth.User', which has been swapped out.HINT: Update the relation to point at 'settings.AUTH_USER_MODEL'.
booking/views.py
from django.shortcuts import render, get_object_or_404
from django.http import HttpResponse, HttpResponseRedirect
from bookings.models import Session
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User# Create your views here.def book(request, Session_id):lesson = get_object_or_404(Session, pk=Session_id)try:client = request.user.idexcept (KeyError, Choice.DoesNotExist):return render(request, 'booking/details.html', {'lesson': lesson,'error_message': "You need to login first",})else:lesson.session_client.add(client)lesson.save()return HttpResponseRedirect("")
settings.py
INSTALLED_APPS = [#Custom apps'mainapp.apps.MainappConfig','bookings.apps.BookingsConfig','django.contrib.admin','django.contrib.auth','django.contrib.contenttypes','django.contrib.sessions','django.contrib.messages','django.contrib.staticfiles',
]AUTH_USER_MODEL = 'mainapp.CustomUser'
bookings/models.py
from django.db import models
from django.contrib.auth.models import User# Create your models here.
class Session(models.Model):session_title = models.CharField(max_length=300)session_time = models.DateTimeField("Time of session")session_difficulty = models.CharField(max_length=200)session_duration = models.IntegerField() session_description = models.TextField()session_client = models.ManyToManyField(User, blank=True) def __str__(self):return self.session_title
I'm trying to change the user model to abstractuser.