AttributeError at /requisitos/cadastrarRequisito/ 'WSGIRequest' object has no attribute 'projeto'
My model:
class Requisito (models.Model):
nomeRequisito = models.CharField(max_length=30, verbose_name=('Nome do Requisito'))
responsavel = models.CharField(max_length=30, verbose_name=('Responsável pelo Desenvolvimento'))
código = models.CharField(max_length=20, verbose_name=('Código do Requisito'))
projeto = models.ForeignKey(Projeto, on_delete=models.PROTECT)
prioridade = models.CharField(max_length=10, verbose_name=('Prioridade do Requisito'))
risco = models.CharField(max_length=10, verbose_name=('Risco do Requisito'))
motivo = models.CharField(max_length=20, verbose_name=('Motivo do Requisito'))
status = models.CharField(max_length=20, verbose_name=('Status do Requisito'))
requisitosImpactados = models.CharField(max_length=100, verbose_name=('Requisitos Impactados'))
user = models.ForeignKey(User, on_delete=models.CASCADE)
estoriaUsuario = HTMLField()
regrasNegocio = HTMLField()
def __str__(self): return self.nomeRequisito
Forms.py
class CadastrarRequisitos(ModelForm):
def __init__(self, projeto, *args, **kwargs):
super(CadastrarRequisitos, self).__init__(*args, **kwargs)
self.fields['projeto'].queryset = Projeto.objects.filter( projeto=Projeto.nomeProjeto)
class Meta:
model = Requisito
fields = ['nomeRequisito', 'responsavel', 'código', 'projeto', 'prioridade', 'status', 'risco', 'motivo', 'requisitosImpactados', 'user', 'estoriaUsuario', 'regrasNegocio']
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5824d6a7-0419-4fa1-a0f6-abe1789675e4n%40googlegroups.com.
No comments:
Post a Comment