Re: forign key no forms
Ta beleza funciona mas na views?
sempre dá um erro dizendo que a views não encontra dados do campo tal e acaba não encontrando nenhum dado em qualquer campo.
2013/2/12 Leonardo S <leonardo.s.comm@gmail.com>
Corrigindo:Pq não tenta?class basiForm(forms.ModelForm):class Meta:model = basifields = ('individuo')--2013/2/12 Leonardo S <leonardo.s.comm@gmail.com>
Pq não tenta?class basiForm(forms.ModelForm):class Meta:model = basifields = ('basi')2013/2/12 Carlos Andre <eucandre@gmail.com>
models.pyclass base(models.Model):nome = models.Charfiels(...)class basi(models.model):individuo = models.Foreignkey(base)forms.pyclass basiForm(forms.Form):nome= forms.ModelsChoicefields(queryset= basi.objects.all())views.pydef mostra(request):....--2013/2/12 Leonardo S <leonardo.s.comm@gmail.com>
Poste o código, senão fica difícil ajudar.--2013/2/12 Carlos Andre <eucandre@gmail.com>
É eu postei e não tive sucesso na implementação!Quando o forms tem uma forma aceitável o views não reconhece os campos!Como posso resolver essa situação?obrigado pela atenção!--2013/2/11 Sandeep kaur <mkaurkhalsa@gmail.com>
2013/2/11 Carlos Andre <eucandre@gmail.com>:
The foreign key is by default acessible in the forms in the form of> Olá pessoal!
> Olha, preciso que um foreign key seja acessível com o forms!
> Tentei de algumas maneiras e não consegui! materiais também não tão
> sucintos!
> alguém pode me ajudar com essa questão?
> Obrigado pela a atenção!
>
drop down. You just need to define the form of your model and the in
template file write this :
<form action="" method="post">
{% csrf_token %}
<table>
{{ form.as_table }}
</table>
<input type="submit" value="Submit">
</form>
--
Sandeep Kaur
E-Mail: mkaurkhalsa@gmail.com
Blog: sandymadaan.wordpress.com
--
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home