2013-11-03 84 views
0

我一直在這裏搜索,發現有些東西與我有相同的錯誤,但我看不到任何與我的問題類似的東西,我敢肯定,這是一個小小的東西,但我是python的新手,無法找到如何解決它。Django TypeError:__init __()需要2個參數(1給出)

models.py

# -*- coding:utf-8 -*- 

from django.db import models 
from django_localflavor_br.br_states import STATE_CHOICES 

""" 
Responsável pelo cadastro de novos profissionais de saúde no sistema(usuários). 

""" 

""" Usuários """ 
class Usuarios(models.Model): 

    """ Formações da área de saúde disponíveis no momento no sistema """ 
    OPCAO_FORMACAO = (
     ('Medicina', '1'), 
     ('Odontologia', '2'), 
    ) 

    """ Informações de registro """ 
    created_at = models.DateTimeField(auto_now_add = True) 
    # updated_at = models.DateTimeField(auto_now = True) 

    """ Informações pessoais """ 
    nome = models.CharField(max_length=30) 
    sobrenome = models.CharField(max_length=60) 
    data_nascimento = models.DateField('Data de nascimento', blank=True) 
    email = models.CharField('E-mail', max_length=80) 

    """ Informações documentais """ 
    rg = models.IntegerField(blank=True) 
    cpf = models.IntegerField(blank=True) 

    formacao = models.ManyToManyField(max_length=20, choices=OPCAO_FORMACAO) 
    registro = models.IntegerField(blank=True) # numero de registro do profissional 
    estado_registro = models.ManyToManyField('Estado', max_length=2, choices=STATE_CHOICES) 

    """ Informações extras """ 


    def __unicode__(self): 
     return self.nome 

錯誤

Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x2b16350>> 
Traceback (most recent call last): 
    File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 93, in inner_run 
    self.validate(display_num_errors=True) 
    File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 280, in validate 
    num_errors = get_validation_errors(s, app) 
    File "/usr/local/lib/python2.7/dist-packages/django/core/management/validation.py", line 35, in get_validation_errors 
    for (app_name, error) in get_app_errors().items(): 
    File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 166, in get_app_errors 
    self._populate() 
    File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 72, in _populate 
    self.load_app(app_name, True) 
    File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 96, in load_app 
    models = import_module('.models', app_name) 
    File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module 
    __import__(name) 
    File "/home/lucas/Documentos/Django/saude/usuarios_registro/models.py", line 12, in <module> 
    class Usuarios(models.Model): 
    File "/home/lucas/Documentos/Django/saude/usuarios_registro/models.py", line 34, in Usuarios 
    formacao = models.ManyToManyField(max_length=20, choices=OPCAO_FORMACAO) 
TypeError: __init__() takes exactly 2 arguments (1 given) 

回答

相關問題