Here is an implementation:
https://stackoverflow.com/a/18179123/4508187
--
Ticket URL: <https://code.djangoproject.com/ticket/32058>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Old description:
> count() doesn't exist in RawQuerySet. It would be good to have the count
> method
>
> Here is an implementation:
> https://stackoverflow.com/a/18179123/4508187
New description:
count() doesn't exist in RawQuerySet. It would be good to have the count
method
`AttributeError: 'RawQuerySet' object has no attribute 'count'`
Here is an implementation:
https://stackoverflow.com/a/18179123/4508187
--
--
Ticket URL: <https://code.djangoproject.com/ticket/32058#comment:1>
Old description:
> count() doesn't exist in RawQuerySet. It would be good to have the count
> method
>
> `AttributeError: 'RawQuerySet' object has no attribute 'count'`
>
> Here is an implementation:
> https://stackoverflow.com/a/18179123/4508187
New description:
count() doesn't exist in RawQuerySet.
`AttributeError: 'RawQuerySet' object has no attribute 'count'`
Here is an implementation:
https://stackoverflow.com/a/18179123/4508187
--
--
Ticket URL: <https://code.djangoproject.com/ticket/32058#comment:2>
Comment (by Mahanth kumar):
But count() exists in FlatValuesListIterable , Can't we use that ?
I'm new here
--
Ticket URL: <https://code.djangoproject.com/ticket/32058#comment:3>
* status: new => closed
* resolution: => wontfix
* type: Uncategorized => New feature
* component: Uncategorized => Database layer (models, ORM)
Comment:
Thanks for this ticket, however `RawQuerySet` doesn't implement all
methods you can use with `QuerySet` and is not intended to do this. We
cannot mirror `QuerySet.count()` because there is no
annotation/aggregation mechanism in `RawQuerySet` and wrapping a raw SQL
(suggested in stack overflow) can be clunky. You can start a discussion on
DevelopersMailingList if you don't agree.
------
Replying to [comment:3 Mahanth kumar]:
> But count() exists in Queryset , Can't we use that ?
No, these are different classes.
--
Ticket URL: <https://code.djangoproject.com/ticket/32058#comment:4>