djmongo

Implementation of per object permissions for Django 1.2 or later
Download

djmongo Ranking & Summary

Advertisement

  • Rating:
  • License:
  • BSD License
  • Price:
  • FREE
  • Publisher Name:
  • Lukasz Balcerzak
  • Publisher web site:
  • http://code.google.com/u/LukaszBalcerzak/

djmongo Tags


djmongo Description

djmongo is yet another mongodb adapter for Django. This one however, is build directly on pymongo, tries to be as small and simple as possible and mimics Django's ORM (managers/querysets).djmongo supports Django >= 1.3.InstallationTo install djmongo simply run:pip install djmongoConfigurationdjmongo provides database engine so configuration is rather straight-forward:DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'database.sqlite', 'TEST_NAME': ':memory:', }, 'mongodb': { 'ENGINE': 'djmongo.backend.mongodb', 'NAME': 'testdb', }}In above example we added mongodb aliased connection to local mongodb server.UsageCreate a document:from djmongo.document import Documentclass MyDocument(Document): class Meta: using = 'mongodb'doc1 = MyDocument.objects.create(data={'foo': 'bar'})doc2 = MyDocument.objects.create(data={'foo': 'baz'})...TestingIn order to properly test an application, one would like to destroy all objects inserted during test run between test cases. Normally, Django does that using transactions, however we need to destroy objects manually. One can do that at tearDown method using connection's extra method called clear_all_collections. Alternatively, one can use subclass of Django's django.test.TestCase: djmongo.test.TestCase.Product's homepage


djmongo Related Software