Typeerror:__ init __()得到了一个意外的关键字参数'max_length'

时间:2022-03-13 06:18:17
  1. Python version 3.3
  2. Python版本3.3

  3. Django version 1.5.2
  4. Django版本1.5.2

Settings.py - Admin Enabled , Timezone changed

Settings.py - 已启用管理员,时区已更改

urls.py - Admin Enabled.

urls.py - 已启用管理员。

__init__.py -is empty

__init__.py-是空的

i created a file "models.py"

我创建了一个文件“models.py”

from django.db import models
from django.contrib import admin


# Create your models here.
class Post(models.Model):
    title = models.CharField(max_lenght=128, verbose_name=u"Title")
    desc = models.TextField(verbose_name=u"News Text")
    datetimestamp = models.DateTimeField(auto_now=True, verbose_name=u"Date,/Time")    

And when i try to manage.py syncdb .

当我尝试manage.py syncdb时。

I am recieving an error typeerror :__init__() got an unexpected keyword argument ' max_length '

我收到错误类型错误:__ init __()得到一个意外的关键字参数'max_length'

I am new with Python\Django . Googled for 2 days and no answer Answers that i found was - type max_lenght instead of maxlenght becouse of version 0.96

我是Python \ Django的新手。谷歌搜索2天,没有回答我发现的答案是 - 类型max_lenght而不是maxlenght因为版本0.96

modles -> model

模型 - >模型

Some old Django with new Python and ect...

一些旧的Django与新的Python等...

Problem is in models.py . Asking for your help .Thank you

问题出在models.py中。请求你的帮助。谢谢

1 个解决方案

#1


9  

You misspelled max_length (you have inverted the g and the t) which makes an argument named max_lenght unknown for Python.

你拼错了max_length(你已经颠倒了g和t),这使得一个名为max_lenght的参数对Python来说是未知的。

#1


9  

You misspelled max_length (you have inverted the g and the t) which makes an argument named max_lenght unknown for Python.

你拼错了max_length(你已经颠倒了g和t),这使得一个名为max_lenght的参数对Python来说是未知的。