Я использую Django несколько недель назад, я запустил приложение django и написал эти строки в model.py
from django.db import models
class Publisher(models.Model):
name = models.CharField(max_length=30)
address = models.CharField(max_lenght=50)
city = models.CharField(max_length=60)
state_province = models.CharField(max_length=30)
country = models.model.CharField(max_length=50)
website = models.URLField()
class Author(models.Model):
first_name = models.CharFiled(max_length=30)
last_name = models.CharField(max_length=40)
email = models.EmailField()
class Book(models.Model):
title = models.CharField(max_length=100)
authors = models.ManyToManyField(Author)
publisher = models.ForeignKey(Publisher)
publication_date = models.DateField()
Когда я пытаюсь проверить или sqlall
python manage.py validate
or
python manage.py sqlall appname
Печатьэто сообщение об ошибке
Traceback (most recent call last):
File "manage.py", line 11, in <module>
execute_manager(settings)
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line
438, in execute_manager
utility.execute()
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line
379, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 191
in run_from_argv
self.execute(*args, **options.__dict__)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 218
in execute
output = self.handle(*args, **options)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 347
in handle
return self.handle_noargs(**options)
File "C:\Python27\lib\site-packages\django\core\management\commands\validate.
y", line 9, in handle_noargs
self.validate(display_num_errors=True)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 245
in validate
num_errors = get_validation_errors(s, app)
File "C:\Python27\lib\site-packages\django\core\management\validation.py", li
e 28, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "C:\Python27\lib\site-packages\django\db\models\loading.py", line 146, i
get_app_errors
self._populate()
File "C:\Python27\lib\site-packages\django\db\models\loading.py", line 61, in
_populate
self.load_app(app_name, True)
File "C:\Python27\lib\site-packages\django\db\models\loading.py", line 78, in
load_app
models = import_module('.models', app_name)
File "C:\Python27\lib\site-packages\django\utils\importlib.py", line 35, in i
port_module
__import__(name)
File "C:\Documents and Settings\root\mysite\..\mysite\books\models.py", line
, in <module>
class Publisher(models.Model):
File "C:\Documents and Settings\root\mysite\..\mysite\books\models.py", line
, in Publisher
address = models.CharField(max_lenght=50)
File "C:\Python27\lib\site-packages\django\db\models\fields\__init__.py", lin
542, in __init__
super(CharField, self).__init__(*args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'max_lenght'
Пожалуйста, помогите мне исправить эту ошибку