Django. Apply function to queryset
问题 I have a queryset and I want to apply function (port_to_app) to its field (dst_port). And then access it from template. How do I do that? I've read about filters and tags, but can't understand the way they work. models.py class FlowQuerySets(models.QuerySet): def top_app(self): return self.values('dst_port')\ .annotate(traffic=Sum('bytes')).order_by('-traffic')[:10] class Flow(models.Model): id = models.BigIntegerField(primary_key = True) ip_src = models.CharField(max_length=15) ip_dst =