I have seen many questions regarding this error in Django, but I'm at a loss because as far as I can tell, no table in my database has a section_id column. I get the error when a user attempts to register and views.py attempts to create a user. I recently changed the "Profile" model (Profile objects are automatically created alongside User objects) in my application to have a section attribute rather than a section_id attribute, but I reset the migrations and recreated the database several times. I'm thinking that it may be an issue with making the migrations, but I really have no idea.
Here is the profile model that used to have a section_id attribute:
class Profile(models.Model):
"""
An extension of the built-in Django user model to allow for the different types of users
"""
USER_TYPES = (
('S', 'Student'),
('I', 'Instructor'),
('C', 'Client')
)
user = models.OneToOneField(User, on_delete=models.CASCADE)
user_type = models.CharField(max_length=1, choices=USER_TYPES)
section = models.ForeignKey(Section, default=None)
@receiver(post_save, sender=User)
def create_user_profile(sender, instance, created, **kwargs):
if created:
Profile.objects.create(user=instance)
@receiver(post_save, sender=User)
def save_user_profile(sender, instance, **kwargs):
if instance.is_staff != 1:
instance.profile.save()
And here is the code that is raising the error:
new_user = User.objects.create_user(email, email=email, password=password)