-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for basic mongoengine integration with Django #22
Comments
Thanks for the suggestion @foxx Have you looked into making https://github.com/MongoEngine/django-mongoengine/tree/master better support Django + Mongo? |
I'd had a look a few months ago, but wasn't keen on the approach used, and ended up making my own lightweight version as linked. For example, handling setup/teardown of unittest data is done inside MongoTestCase, but this isn't the best way of doing things. It requires the user to inherit their unit test directly from that class, which is an unclean pattern. It would be slightly better if it worked as a mix-in, which would most likely need to contain some nasty MRO magic, but even then it still wouldn't be a great approach, for much the same reasons. This also requires you to use Both of these features could probably be merged without too much problem, although it would require a lot of testing as monkey patching could cause some weird edge cases. These changes would, naturally, be backwards incompatible for most people too. I'm not sure if it would break the other elements such as forms/admin, I personally have no use for them as all my use cases for Mongo involve multi layer documents. The forms abstraction for Django is just not designed well for deep document resources, even with the support of EmbeddedFormField (in my own opinion), but this is a design fault with Django, not |
@foxx : We can use https://github.com/hspandher/django-test-addons which provides the setup and teardown functionality after run of each test case. I also have concern here, How are we running the test cases here? I am trying to use pytest, will it be usable? |
So far, @foxx killed his repository. |
I have since stopped using Django, as I now consider it broken by design. The repo itself was killed because of backwards incompatible changes after the last Django release. I can dig out the code from archive if needed, but it's probably better to do it again from scratch. |
@foxx your blog post "42 awesome tools for programmers" does not mention django in section "Things to avoid". Wouldn't you write something about why django is broken and what do you use instead? |
@qwiglydee I've got something coming out soon that tackles this very topic, stay tuned :) |
Not sure if this helps but, I've made a simple django-mongoengine which can support handling Mongoengine connections via the Django connection manager, and adds setup/teardown unit test support when using mongo databases.
There is some nasty monkeypatching to make this work, but so far it seems to work pretty well out of the box. Although it doesn't add support for admin panels or anything, it works great for those that just want to use a mongodb connection in Django without any fuss.
Happy to do a better PR if you feel it's worthy enough for inclusion.
The text was updated successfully, but these errors were encountered: