Answer the question
In order to leave comments, you need to log in
How to get calculated model fields in queryset.values()?
I am implementing a table model that has one calculated field. The tablet must be given in the form of an array of dictionaries through the api. When I try to get a calculated field in queryset.values(), I get an error saying that a field with that name does not exist.
Here is the method in the model:
@property
def summaFakt(self):
return 111111
list = list.values(
'id',
'name',
'number',
'sum', # злополучное поле
'description'
)
sum = list.first().sum
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question