kiddouk / redisco

A Python Library for Simple Models and Containers Persisted in Redis
MIT License
438 stars 78 forks source link

Filter by ID #1

Closed marconi closed 12 years ago

marconi commented 12 years ago

How do I filter by ids?

I tried filtering by Message.filter(id__gt=0) and its giving me <broken repr (AttributeNotIndexed: Attribute id__gt is not indexed in Message class.>.

kiddouk commented 12 years ago

Ids are not indexed at the moment. The best way to retrieve a single Item is to use get_by_id

marconi commented 12 years ago

I ended-up creating an IntegerField and override save() then assign value of self.id to this custom integer field. Then I can use the custom field field like: Message.filter(mid__gt=0)