unsupported operand type (s) for -: 'NoneType' and 'NoneType'

88 views
Skip to first unread message

Elias Coutinho

unread,
Apr 7, 2019, 8:15:36 PM4/7/19
to Django users
Save some people.

Friends lack sufficient knowledge to try to solve this problem alone.

I have these 3 classes below:


In the admin I can list in the History the added values of Account and Payment as well so I will search in the respective models, however I think it is interesting to also present a column with the remaining value, that is, Account - Payment (Clustered value of accounts subtracted from the payment) .

I thought it would be easy to do but it returns me the following error:

unsupported operand type (s) for -: 'NoneType' and 'NoneType'

I know it means the message but I do not know how to solve it.

Has anyone ever experienced this? Can you help me?

Vinod Kumar

unread,
Apr 7, 2019, 8:29:52 PM4/7/19
to django...@googlegroups.com
Hi
It error generate from model string represention where you are trying to add two other relationship model key those don't have any object.

Please let me know if you have any other questions.
Or share with me model structure.

I'm happy to help you.

--
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 django...@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/d3190fd9-0fdf-4e1d-9f3d-6a0120662b3e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

************************************************************************

This e-mail and all attachments are intended solely for use by the intended recipient and may contain confidential / proprietary information of KiwiTech, LLC, subject to important disclaimers and conditions including restrictions on the use, disclosure, transfer or export of such information. If you have received this message in error or are not the named recipient(s), please immediately notify the sender at the telephone number stated above or by reply e-mail and delete this e-mail from your computer

Elias Coutinho

unread,
Apr 8, 2019, 8:35:51 AM4/8/19
to django...@googlegroups.com
return (self.totais() or 0) - (self.baixado() or 0)

Geat!

Thank's

You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/ZF9sj04neCQ/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.

For more options, visit https://groups.google.com/d/optout.


--
Elias Coutinho.
Aprender sobre alguns assuntos é fundamental.
Aprender sobre Deus é indiscutivelmente o melhor conteúdo.
Reply all
Reply to author
Forward
0 new messages