TypeError: Field.__init__() получил неожиданный аргумент ключевого слова 'max_lenght'

from django.db import models

class Coustomer (models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) имя = models.CharField(max_length=100) locality = models.CharField(max_lenght=150) zipcode = models.IntegerField() state = models.CharField(choices=STATE_CHOICES,max_lenght=100)

class Product(models.Model): title = models.CharField(max_lenght=100) цена_продажи = models.FloatField() скидка_цена = models.FloatField() описание = models.TextField() бренд = models.CharField(max_lenght = 100) категория = models.CharField(choices=CATEGORY_CHOICE, max_lenght=2) prodect_image = models.ImageField(uploded_to = 'Productimg')

enter code here

Значит, вы неправильно пишете max_length.

class Customer (models.Model):
    user = models.ForeignKey(User, on_delete=models.CASCADE) 
    name = models.CharField(max_length=100) 
    locality = models.CharField(max_length=150) zipcode= models.IntegerField() 
    state = models.CharField(choices=STATE_CHOICES,max_length=100)

class Product(models.Model): 
    title = models.CharField(max_length=100) 
    selling_price = models.FloatField() 
    discount_price = models.FloatField() 
    description = models.TextField() 
    brand = models.CharField(max_length = 100) 
    category = models.CharField(choices=CATEGORY_CHOICE, max_length=2) 
    product_image = models.ImageField(uploded_to = 'Productimg')
Вернуться на верх