Friday, February 3, 2012

Re: Views in django

Calculate in view, in template should print values .  Can group it in dict i think.

On Feb 3, 2012 10:39 PM, "Sandeep kaur" <mkaurkhalsa@gmail.com> wrote:
On Fri, Feb 3, 2012 at 7:52 PM, Weldan <mweldan@gmail.com> wrote:
> Entries.objects.count()
>
That will be applicable if I want to his for only 1 table's entry.
But here I have views as :

                       cd = form.cleaned_data
                       name_and_address = cd['name_and_address']
                       title = get_object_or_404(Variable, pk='1')
                       sign = get_object_or_404(Variable, pk='3')
                       from TCC11_12.automation.choices import *
                       client =
ClientJob.objects.filter(name_and_address=name_and_address)
                       amount = Amount.objects.all()
                       suspence = Suspence.objects.all()

and for this I have template as :

  {% if client %}
   {% for clients in client %}
   {% for amounts in amount %}

        {% if clients.job_no == amounts.job_no %}

        {% if clients.name_and_address == clients.name_and_address %}

                       <td>{{ clients.receipt_no }}</td>
                       <td> {{ clients.date }}</td>
                       <td ALIGN="right">{{amounts.total}}</td>
                       <td ALIGN="right">{{amounts.net_total}}</td>
               {% endif  %}

               {% endif  %}
               </tr>
       {% endfor %}

       {% endfor %}
{% endif %}


When all this is applied, it creates a view out of 2 tables i.e Amount
and ClientJob without using foreign key. Now I want to have sum of the
total and net_total fields for the views generated.

--
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 post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment