Hi!
I'm writing an action for the django admin site. My model looks like:
class order(models.Model):
entity = models.ForeignKey(entity)
[...]
I select an arbitrary number of orders and I need to know the different
entities that they have. It works on shell:
>>> queryset = order.objects.all()
>>> queryset.all().values_list('entity', flat=True).distinct()
[1L]
But on Admin seems the distinct part of the queryset doesn't work
class orderAdmin(admin.ModelAdmin):
[....]
def invoice(self, request, queryset):
print str(queryset.all().values_list('entity',
flat=True).distinct())
[....]
Here the output of selecting all order elements(4), the output is a little
different from the same operation in shell :(
[1L, 1L, 1L, 1L]
What's happening here?
Thanks!
--
Marc
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.