calculating two integers fields in django..

35 views
Skip to first unread message

Muhammed Bilal

unread,
Sep 2, 2019, 9:40:11 AM9/2/19
to Django developers (Contributions to Django itself)

I have a model some thing like this

class Add(models.Model):
   Budget = models.IntegerField()
   Expense = models.IntegerField()

Now I would like to do calculations for example   Sum , subtracting two fields and multiplying them                   (budget - Expense) ..      (budget + Expense)       (budget * Expense)    kindly help me . 

Uzama Zaid

unread,
Sep 2, 2019, 11:50:25 AM9/2/19
to django-d...@googlegroups.com
You can use methods to do that

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/ed230914-03be-4de2-b626-315a86edadea%40googlegroups.com.
--
Best Regards,

MJU ZAID
Student (2016 batch)
Department of Computer Science & Engineering
University of Moratuwa

Manoj Jadhav Patil

unread,
Sep 2, 2019, 11:56:32 AM9/2/19
to django-d...@googlegroups.com
If you are using MySQL. You can use virtual fields option.


Regards,
Manoj

Adam Johnson

unread,
Sep 2, 2019, 12:27:32 PM9/2/19
to django-d...@googlegroups.com
Hi!

I think you've found the wrong mailing list for this post. This mailing list is for the development of Django itself, not for support using Django. This means the discussions of bugs and features in Django itself, rather than in your code using it. People on this list are unlikely to answer your support query with their limited time and energy. Read more on the mailing lists at https://www.djangoproject.com/community/

For support, please use the django-users mailing list, or IRC #django on Freenode, or a site like Stack Overflow. There are people out there willing to help on those channels, but they might not respond if you don't ask your question well. Stack Overflow's question guide can help you frame it well: https://stackoverflow.com/help/how-to-ask .

Also if you haven't read it, please take a look at Django's Code of Conduct: https://www.djangoproject.com/conduct/ . These are our "ground rules" for working well as a community, and will help you get the most out of Django and our fantastic community.

Thanks for your understanding,

Adam



--
Adam
Reply all
Reply to author
Forward
0 new messages