Skip to content

simonklee/odis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

odis

odis - objects in Redis for Python.

Install odis

$ pip install git+git://github.com/simonz05/odis.git

Use odis

from odis import Model, CharField, DateTimeField

class Foo(Model):
    username = CharField(index=True, unique=True)
    created_at = DateTimeField(aut_now_add=True)


>>> obj = Foo(username='foo')
>>> obj.save()
True

>>> Foo.obj.get(username='foo')
<Foo {'username': 'foo', 'pk': 1, 'created_at': datetime.datetime(2012, 1, 14, 0, 0)}>

>>> Foo.obj.filter(username='foo')
<odis.QuerySet at 0x24e50d0>

Acknowledgment

Ohm, redisco and Django internals were used to figure out how to solve similar problems.