0

I am trying to make migrations to a new app 'users' and keep receiving the error: "TypeError: Field.init() got an unexpected keyword argument 'max_Length'"

I previously encountered this error when making migrations on my last app and was able to find the solution on a stackoverflow post which I can't seem to relocate.

I know that max_Length is valid because it worked last time but can't seem to remember what I did to make the migrations work.

My settings.py files with the users app activated

 > INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'projects.apps.ProjectsConfig',
    'users.apps.UsersConfig',
]

My models.py in my users app:

> from django.db import models
from django.contrib.auth.models import User #/Django User Model 
import uuid 
# Create your models here.

class Profile(models.Model):
    user = models.OneToOneField(
        User, on_delete=models.CASCADE, null=True, blank=True)
    name = models.CharField(max_length=200, blank=True, null=True)
    email = models.EmailField(max_Length=500, blank=True, null=True)
    short_intro = models.CharField(max_length=200, blank=True, null=True)
    bio = models.TextField(blank = True, null=True)
    profile_image = models.ImageField(null=True, blank=True, upload_to='profiles/', default="profiles/user-default.png")
    social_website = models.CharField(max_length=200, blank=True, null=True)
    social_instagram = models.CharField(max_length=200, blank=True, null=True)
    social_youtube = models.CharField(max_length=200, blank=True, null=True)
    social_twitter = models.CharField(max_length=200, blank=True, null=True)
    created = models.DateTimeField(auto_now_add=True)
    id = models.UUIDField(default=uuid.uuid4, unique=True, 
                    primary_key=True, editable=False)

    def __str__(self):
        return str(self.user.username)

I've spent a lot of time trying to figure out what I am missing but can't seem to get it.

  • Python manage.py makemigrations worked last time with the projects app having the same 'max_Length' constraints.

Any ideas on how I can fix this? Thanks in advance

0 Answers0