Showing proper data in django template

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Showing proper data in django template

Abu Yusuf
Hello, I have two models here:

class Tender(models.Model):
  project = models.ForeignKey(Project, verbose_name=_("Select project"), on_delete=models.CASCADE)
  name = models.CharField(_("Tender name"), max_length=250)
  value = models.FloatField(_("Tender value"), default=0, null=True, blank=True)
  est_cost = models.FloatField(default=0, null=True, blank=True)

  def __str__(self):
    return self.name

class BillReceive(models.Model):
  tender = models.ForeignKey(Tender, verbose_name=_("Select tender"), on_delete=models.CASCADE)
  date = models.DateField(default=datetime.date.today)
  received_amount = models.FloatField(default=0)
  due_amount = models.FloatField(default=0, null=True, blank=True)
  total = models.FloatField(
    blank=True,
    null=True
  )

And the views here:

def bill_receive_of_tenders(requestpk):
  tender = get_object_or_404(Tender, pk=pk)
  bill_receive = BillReceive.objects.filter(tender=tender).order_by('date')
  ctx = {'tenders': tender, 'bill_receives': bill_receive}
  return render(request, 'boro_khata/bill_receive_of_tenders.html', ctx)

I would like to see the due_amount liked this:

ss.png



60, 40, 35

Can Anyone help me out here? 

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5b7683e0-027d-4118-9c16-f1da24495298%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Showing proper data in django template

Abu Yusuf


On Monday, September 16, 2019 at 3:14:43 PM UTC+6, Abu Yusuf wrote:
Hello, I have two models here:

class Tender(models.Model):
  project = models.ForeignKey(Project, verbose_name=_("Select project"), on_delete=models.CASCADE)
  name = models.CharField(_("Tender name"), max_length=250)
  value = models.FloatField(_("Tender value"), default=0, null=True, blank=True)
  est_cost = models.FloatField(default=0, null=True, blank=True)

  def __str__(self):
    return <a href="http://self.name" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fself.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE3JOkg7Vn23FjpPTI8mfGhfDqO3A&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fself.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE3JOkg7Vn23FjpPTI8mfGhfDqO3A&#39;;return true;">self.name

class BillReceive(models.Model):
  tender = models.ForeignKey(Tender, verbose_name=_("Select tender"), on_delete=models.CASCADE)
  date = models.DateField(default=datetime.date.today)
  received_amount = models.FloatField(default=0)
  due_amount = models.FloatField(default=0, null=True, blank=True)
  total = models.FloatField(
    blank=True,
    null=True
  )

And the views here:

def bill_receive_of_tenders(requestpk):
  tender = get_object_or_404(Tender, pk=pk)
  bill_receive = BillReceive.objects.filter(tender=tender).order_by('date')
  ctx = {'tenders': tender, 'bill_receives': bill_receive}
  return render(request, 'boro_khata/bill_receive_of_tenders.html', ctx)

I would like to see the due_amount liked this:

ss.png



60, 40, 35

Can Anyone help me out here? 

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/76cd925d-b092-43ba-8f28-ba0744a6fdfa%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Showing proper data in django template

Adesina Oluwaseun
In reply to this post by Abu Yusuf


On Mon, Sep 16, 2019 at 10:15 AM Abu Yusuf <[hidden email]> wrote:
Hello, I have two models here:

class Tender(models.Model):
  project = models.ForeignKey(Project, verbose_name=_("Select project"), on_delete=models.CASCADE)
  name = models.CharField(_("Tender name"), max_length=250)
  value = models.FloatField(_("Tender value"), default=0, null=True, blank=True)
  est_cost = models.FloatField(default=0, null=True, blank=True)

  def __str__(self):
    return self.name

class BillReceive(models.Model):
  tender = models.ForeignKey(Tender, verbose_name=_("Select tender"), on_delete=models.CASCADE)
  date = models.DateField(default=datetime.date.today)
  received_amount = models.FloatField(default=0)
  due_amount = models.FloatField(default=0, null=True, blank=True)
  total = models.FloatField(
    blank=True,
    null=True
  )

And the views here:

def bill_receive_of_tenders(requestpk):
  tender = get_object_or_404(Tender, pk=pk)
  bill_receive = BillReceive.objects.filter(tender=tender).order_by('date')
  ctx = {'tenders': tender, 'bill_receives': bill_receive}
  return render(request, 'boro_khata/bill_receive_of_tenders.html', ctx)

I would like to see the due_amount liked this:

ss.png



60, 40, 35

Can Anyone help me out here? 

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5b7683e0-027d-4118-9c16-f1da24495298%40googlegroups.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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHBkvW%3Dk8AcDxnzA8SEcQKHu1CKq8zqvYEVNdmh60OoJYQHd0A%40mail.gmail.com.

INDUSTRIAL BASED SUPERVISOR.docx (23K) Download Attachment
UNIVERSITY STAFF ASSESSMENT OF STUDENT.docx (21K) Download Attachment
SUPERVISOR'S LOG BOOK.docx (17K) Download Attachment