jazzband / django-mongonaut

Built from scratch to replicate some of the Django admin functionality and add some more, to serve as an introspective interface for Django and Mongo.
MIT License
240 stars 67 forks source link

changed MongoModelFormBaseMixin to inherit model's Meta class ordering #74

Closed anzellai closed 9 years ago

anzellai commented 9 years ago

The MongoModelFormBaseMixin form fields are not ordered from model_dict (based on Python's dictionary) and thus form fields are randomly rendered on view.

Updated: in fact it is mongoengine has not preserved the form fields ordering (normally it's inherited by SortedDict/OrderedDict under metaclass __new__), so unless mongoengine has fixed this, we need a workaround to set fields ordering for the form (auto to sort by field names).

pydanny commented 9 years ago

Tests?

anzellai commented 9 years ago

@pydanny I have just looked at the example app and the test cases, they are for older Django 1.4 and when I tried to run it locally it failed with DatabaseError: no such table: django_session.

Because I'm running on Django 1.7, do you want me to keep with 1.4 and add to the existing example app + test case, or you'd prefer me to write an app + test for newer Django?

pydanny commented 9 years ago

If you could update for Django 1.7 that would be wondeful. I have no problems with deprecating really old versions of Django.

anzellai commented 9 years ago

@pydanny I have added example/blog_1_7 project with articles app with TestCase based on the original blog, and have added a separated file runtests_1_7.py for Django 1.7+.

binklee commented 9 years ago

super nice the ability to keep the order. Is a new release with this new feature going to happen?

anzellai commented 9 years ago

@pydanny any update on this yet? @binklee rather than a feature, this is more like a workaround fix on MongoEngine. But yes it is better to have the fields ordered :)