I have this model which map to a postgresql view class AppModel(models.Model): nbr = models.BigIntegerField(blank=True, null=True) region = models.ForeignKey(AppWilaya,blank=True, null=True) date_preorder = models.DateField(blank=True, null=True) id = models.IntegerField(primary_key=True,blank=True, db_column= 'dummy_id')
What I want to achieve is to have region > sum(nbr), so: class AppModelAdmin(admin.ModelAdmin): .... def queryset(self, request): qs = super(AppModelAdmin, self).get_queryset(request) qs=qs.values("region").annotate(total=Sum( 'nbr')) But Django is throwing an exception: Exception Value: 'dict' object has no attribute '_meta' Exception Location: D:\Python335\lib\site-packages\django\contrib\admin\util.py in lookup_field, line 242 Note when I remove .values("region") the exception doesn't occure. Am I missing something ? -- 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+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0809fcb9-238c-4495-9ed3-7fb1d78e6b21%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.