Permalink
Browse files

small updates: 0.2.1

  • Loading branch information...
1 parent 06b423d commit ef2d316cadd641abb81d6149d6ebd00b41bb2adb @last-partizan last-partizan committed Feb 6, 2016
Showing with 13 additions and 11 deletions.
  1. +8 −2 README.rst
  2. +4 −7 django_mongoengine/fields/djangoflavor.py
  3. +0 −1 example/tumblelog/tumblelog/settings.py
  4. +1 −1 setup.py
View
@@ -19,8 +19,8 @@ Working / Django 1.9
* [ok] auth
* [?] admin - partially working, some things broken
-Current status, let's call it version 0.2, still far away from public release
------------------------------------------------------------------------------
+Current status, let's call it version 0.2.1, still far away from public release
+-------------------------------------------------------------------------------
Many parts of projects rewritten/removed;
Instead of copying django code i try to subclass/reuse/even monkey-patch;
@@ -33,6 +33,12 @@ get thigs work with django. It replaces mongo _meta on model/class and
provide django-like interface.
It get's replaced after class creation via some metaclass magick.
+Fields notes
+------------
+
+* mongo defaults Field(required=False), changed to django-style defaults
+ -> Field(blank=False), and setting required = not blank in Field.__init__
+
TODO
@@ -1,11 +1,11 @@
from django.utils.text import capfirst
from django.core.validators import RegexValidator
from django import forms
+from django.db.models import Field
from mongoengine import fields
from django_mongoengine.forms import fields as formfields
-from django_mongoengine.forms.field_generator import MongoFormFieldGenerator
_field_defaults = (
("editable", True),
@@ -18,19 +18,16 @@
class DjangoField(object):
+ get_choices = Field.__dict__["get_choices"]
+
def __init__(self, *args, **kwargs):
for k, v in _field_defaults:
kwargs.setdefault(k, v)
+ kwargs["required"] = not kwargs["blank"]
super(DjangoField, self).__init__(*args, **kwargs)
if self.verbose_name is None and self.name:
self.verbose_name = self.name.replace('_', ' ')
-
- def oldformfield(self, **kwargs):
- return MongoFormFieldGenerator().generate(
- self, **kwargs
- )
-
def formfield(self, form_class=None, choices_form_class=None, **kwargs):
"""
Returns a django.forms.Field instance for this database Field.
@@ -19,7 +19,6 @@
MONGODB_DATABASES = {
'default': {'name': 'django_mongoengine'}
}
-DJANGO_MONGOENGINE_OVERRIDE_ADMIN = True
DATABASES = {
View
@@ -15,7 +15,7 @@
import sys, os
-__version__ = '0.2.0'
+__version__ = '0.2.1'
__description__ = 'Django support for MongoDB via MongoEngine',
__license__ = 'BSD'
__author__ = 'Ross Lawley',

0 comments on commit ef2d316

Please sign in to comment.