Calculation field - best practice

15 views
Skip to first unread message

Mario Bisiani

unread,
Jan 21, 2020, 7:30:37 AM1/21/20
to Django users
Good morning,

first post here!

I have a quesion for you. I need to have a calculated field from two attribute of different class in model.py. Which is the best practice to perform calcs : in model.py by function or in the view.py?

In the case of model.py how can i access the atribut of the different class?

Thank you to you all,

M

Sencer Hamarat

unread,
Jan 21, 2020, 8:27:37 AM1/21/20
to django...@googlegroups.com

IMO this should be done in view if it's just for display purposes in rendered page.
Although, the best method is doing it in a template tag.

Regards,
Sencer HAMARAT



--
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 view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3b7d11f3-c6b6-4892-a5d0-591e9dc2055e%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages