Update .... This worked for me..Thanks a lot for your help....:- 

<table> <th>FIELD1</th> <th>FIELD2</th> <th>FIELD3</th> <th>FIELD4</th> <th>
FIELD5</th> <th>FIELD6</th> <th>FIELD7</th> <th>FIELD8</th> * {% for r in 
ret_list %} * <tr> <td> {{r.field1}} </td> <td> {{r.field2}} </td> <td> 
{{r.field3}} </td> <td> {{r.field4}}</td> <td> {{r.field5}} </td> <td> 
{{r.field6}} </td> <td> {{r.field7}} </td> <td> {{r.field8 }} </td> </tr> * 
{% endfor %} *</table>



On Sunday, June 23, 2019 at 8:15:58 PM UTC-4, Sudeep Gopal wrote:
>
> Thank you so much Joe...
>
> I was actually able to go forward. 
>
> With the below code  :-
>
> <table>
>   {% for r in list1 %}
>     {% cycle '<tr>' '' '' '' '' '' '' ''%}
>       <td>{{r}}</td>
>     {% cycle '' '' '' '' '' '' '' '</tr>' %}
>   {% endfor %}
>
>
>
> The {{r}} in the above code , gives only the reference or the pointer 
> value. For eg, template cannot recognize it is field1 which I want to 
> display or something,,,
> How do we get the value of that reference ?
>
> My result look like this :-
>
> field1 field2 field3 field4 field5 field6 field7 
> <TDMAsearch.TDMAsearchutils.TDMAInroute object at 0x0000000005393FD0> 
> <TDMAsearch.TDMAsearchutils.TDMAInroute 
> object at 0x000000000581B550> <TDMAsearch.TDMAsearchutils.TDMAInroute 
> object at 0x000000000581B278> <TDMAsearch.TDMAsearchutils.TDMAInroute 
> object at 0x0000000005413908> <TDMAsearch.TDMAsearchutils.TDMAInroute 
> object at 0x00000000053C27F0> <TDMAsearch.TDMAsearchutils.TDMAInroute 
> object at 0x00000000053C20B8> <TDMAsearch.TDMAsearchutils.TDMAInroute 
> object at 0x00000000053C2278> 
> <TDMAsearch.TDMAsearchutils.TDMAInroute object at 0x0000000005594F28> 
> <TDMAsearch.TDMAsearchutils.TDMAInroute 
> object at 0x0000000005413668> <TDMAsearch.TDMAsearchutils.TDMAInroute 
> object at 0x0000000005413358> <TDMAsearch.TDMAsearchutils.TDMAInroute 
> object at 0x0000000005413DA0> <TDMAsearch.TDMAsearchutils.TDMAInroute 
> object at 0x00000000054DDF98> <TDMAsearch.TDMAsearchutils.TDMAInroute 
> object at 0x00000000053C2978> <TDMAsearch.TDMAsearchutils.TDMAInroute 
> object at 0x00000000055943C8> 
>
> I want it to look at the content 
>
> CARRIER1 230 128 QPSK 1000 125 155 
> CARRIER2 230 256 QAM 1000 125 155 
>
>
>
> On Saturday, June 22, 2019 at 9:03:19 AM UTC-4, Joe Reitman wrote:
>>
>> The example code you provided will create a <tr> on the first iteration 
>> of the loop and </tr> tag every 4th iteration of the loop. This cycle will 
>> continue resulting in a table with 4 columns of data. Example:
>>
>> results = [ 1, 2, 3, 4, 5, 6, 7, 8 ]
>>
>>
>> <table>
>>   <tr>
>>     <td>1</td>
>>     <td>2</td>
>>     <td>3</td>
>>     <td>4</td>
>>   </tr>
>>   <tr>
>>     <td>5</td>
>>     <td>6</td>
>>     <td>7</td>
>>     <td>8</td>
>>   </tr></table>
>>
>>
>>
>> If you have 2 lists, render them from your view like return render(
>> request, 'polls/detail.html', {'list1': list1, 'list2': list2})
>> In your template create an 8 column table:
>>
>> <table>
>>   {% for r in list1 %}
>>     {% cycle '<tr>' '' '' '' '' '' '' ''%}
>>       <td>{{r}}</td>
>>     {% cycle '' '' '' '' '' '' '' '</tr>' %}
>>   {% endfor %}
>>
>> {% for r in list2 %}
>>     {% cycle '<tr>' '' '' '' '' '' '' ''%}
>>       <td>{{r}}</td>
>>     {% cycle '' '' '' '' '' '' '' '</tr>' %}
>>   {% endfor %}
>>
>> </table>
>>
>>
>> Hope this helps
>>
>> On Friday, June 21, 2019 at 5:58:21 PM UTC-5, Sudeep Gopal wrote:
>>>
>>> Hello, 
>>>
>>> I am new to django. 
>>>
>>> I am using django forms in my project and I am not using django models. 
>>>
>>> From the user,  my django form asks for 4 inputs :- signal_to_noise_1 , 
>>> signal_to_noise_2, bandwidth1 and bandwidth2. 
>>>
>>> Based on these values I use my  look up table and I create a results 
>>> which are 2 lists of records.
>>>  Each list has approximately 40 to 50 records. Each record has 8 fields. 
>>> (field1,...field8) ...
>>>
>>> *Each list *looks like this (if my description is not clear) field1 is 
>>> unique. 
>>>
>>> field1  field2  field3 
>>>
>>>
>>>
>>> field8
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Both the lists (with each list having about 50 records) are in my django 
>>> view. 
>>>
>>> From what I read online, I can use the render() method which has a 
>>> *dictionary 
>>> *called context. (
>>> https://docs.djangoproject.com/en/2.2/ref/templates/api/#rendering-a-context
>>>  
>>> <https://www.google.com/url?q=https%3A%2F%2Fdocs.djangoproject.com%2Fen%2F2.2%2Fref%2Ftemplates%2Fapi%2F%23rendering-a-context&sa=D&sntz=1&usg=AFQjCNFeyvWxqdh2HVrALIVw53ScRw4SVw>
>>> )
>>>
>>> I am not sure how to convert these list of record objects to this 
>>> dictionary format which has {"name":value} pair. 
>>>
>>> Even the django tables requires it in the dictionary format.....
>>>
>>> The nearest thing which I found was 
>>> https://stackoverflow.com/questions/9388064/django-template-turn-array-into-html-table
>>>  
>>>
>>> But I did not understand what exactly the below syntax does and how I 
>>> can customize it to my usecase ....any input would be greatly appreciated 
>>> ...
>>>
>>> <table>
>>>   {% for r in results %}
>>>     {% cycle '<tr>' '' '' '' %}
>>>       <td>{{r.content}}</td>
>>>     {% cycle '' '' '' '</tr>' %}
>>>   {% endfor %}</table>
>>>
>>>
>>>
>>>
>>>
>>>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8331c29f-97ce-4ec6-9aa9-67c36c0997ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to