I see. I don't understand how this works: {{
itens.instance.idproduto.codigobarra
}} when this doesn't: {{ itens.instance.idproduto.idmercadoria.referencia }}

Can you post your template code?




On Fri, Aug 23, 2013 at 10:13 AM, Fellipe Henrique <[email protected]>wrote:

> form.instance is "Pedido"  model, not "ItensPedido".
>
> My "ItensPedido" has "idproduto" not my "Pedido". and all idproduto has
> idmercadoria, it a required field, never, never go null`s this field.
>
> Cheers,
>
> Em sexta-feira, 23 de agosto de 2013 12h15min15s UTC-3, Mark escreveu:
>>
>> Are you sure the idmercadoria is not None on that idproduto record?
>>
>> {{ form.instance.idproduto.**idmerc**adoria }} Does this display
>> anything?
>> How about {{ form.instance.idproduto }}?
>>
>> If these don't display, verify the records in your database. In Django
>> templates, if something is None or does not exist, it will not raise an
>> exception, it just ignores it and remains blank. Also verify the referencia
>> field is not empty. If the field is 'NOT NULL' then it will be an empty
>> string if it is blank.
>>
>>
>>
>> On Thu, Aug 22, 2013 at 12:58 PM, Fellipe Henrique <[email protected]>wrote:
>>
>>> No, nothing displayed..
>>>
>>> Em quinta-feira, 22 de agosto de 2013 13h38min04s UTC-3, Mark escreveu:
>>>>
>>>> Try dropping the .value from referencia. Like {{
>>>> form.instance.idproduto.**idmerc**adoria.referencia }}. Does this work?
>>>>
>>>>
>>>> On Thu, Aug 22, 2013 at 9:35 AM, Fellipe Henrique <[email protected]>wrote:
>>>>
>>>>> I tried again.. and work if I have just 1 FK, if I have more then one,
>>>>> doesn't work, like this:
>>>>>
>>>>> I have this models:
>>>>> Itens -> produto -> mercadoria
>>>>>
>>>>> itens:
>>>>>   idproduto = FK (produto)
>>>>> produto:
>>>>>   idmercadoria = FK(mercadoria)
>>>>> mercadoria:
>>>>>   referencia = Char
>>>>>
>>>>> I try to get "referencia" field, as you told:
>>>>>
>>>>> {{ form.instance.idproduto.**idmerc**adoria.referencia.value }}
>>>>>
>>>>> doesn't work.. what I miss?
>>>>>
>>>>> Here is my complete models, forms and view: http://pastebin.com/**w2Tm
>>>>> **yLzt <http://pastebin.com/w2TmyLzt>
>>>>>
>>>>>  Cheers,
>>>>>
>>>>>
>>>>> Em quinta-feira, 22 de agosto de 2013 13h24min31s UTC-3, Fellipe
>>>>> Henrique escreveu:
>>>>>
>>>>>> Ok, I read that, but the problem persist.. I try to use as you told,
>>>>>> but nothing show... and no errors appears..
>>>>>>
>>>>>> Sorry about my first line.. I just stop here, simple problem, in more
>>>>>> then 1 day, and I don't find any solution, anything on internet to...
>>>>>>
>>>>>> Cheers
>>>>>> Fellipe
>>>>>>
>>>>>>
>>>>>>>  --
>>>>> 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...@**googlegroups.**com.
>>>>> To post to this group, send email to [email protected].
>>>>>
>>>>> Visit this group at 
>>>>> http://groups.google.com/**group**/django-users<http://groups.google.com/group/django-users>
>>>>> .
>>>>> For more options, visit 
>>>>> https://groups.google.com/**grou**ps/opt_out<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...@**googlegroups.com.
>>> To post to this group, send email to [email protected].
>>> Visit this group at 
>>> http://groups.google.com/**group/django-users<http://groups.google.com/group/django-users>
>>> .
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out<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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-users.
> 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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to