I think the new standard for non-rel django-nonrel databases . I don't know if django-nonrel is ready or redis support is ready, but they have a guide on writing a custom backend without sql .
, , redis django , DatabaseBackend. django , ACID. syncdb? Querysets?
, models.Manager . :
def fill_model_instance(instance, values):
""" Fills an model instance with the values from dict values """
attributes = filter(lambda x: not x.startswith('_'), instance.__dict__.keys())
for a in attributes:
try:
setattr(instance, a, values[a.upper()])
del values[a.upper()]
except:
pass
for v in values.keys():
setattr(instance, v, values[v])
return instance
class AuthorManager( models.Manager ):
def get_query_set(self):
raise NotImplementedError("Maybe you can write a Non relational Queryset()! ")
def latest(self, *args, **kwargs):
pass
def filter(self, *args, **kwargs):
pass
def open_connection(self):
pass
def search_author( self, *args, **kwargs ):
self.open_connection()
authors_list = [{'name': 'Leibniz', 'email': 'iinventedcalculus@gmail.com'},
'name': 'Kurt Godel','email': 'self.consistent.error@gmail.com'}]
return [fill_instance(Author(), author) for author in authors_list]
class Author( models.Model ):
name = models.CharField( max_length = 255 )
email = models.EmailField( max_length = 255 )
def save(self):
raise NotImplementedError("TODO: write a redis save")
def delete(self):
raise NotImplementedError(""TODO: write a delete save")
class Meta:
managed = False
, , , django.
. -.