I have a model with the following fields and decorators:
class Item(models.Model):
title = models.CharField(db_index=True, max_length=100)
thumb = models.CharField(max_length=1000)
vendor = models.CharField(max_length=15)
url = models.CharField(max_length=255, unique=True)
views = models.CharField(max_length=64)
@property
def parsed_thumb()
return = self.url + "/static/" + self.thumb
which I query in a class based view with:
results = Items.objects.filter(title__icontains=query).order_by('-views')[offset:limit].values('id', 'url', 'title', 'vendor', 'thumb')
The problem is the call to values()
returns db fields and, as far as I know, has no way of interacting with @property decorators that belong to the Items model.
I need the return value from parsed_thumb()
. What are my options?