GithubHelp home page GithubHelp logo

django-mongotools's People

Contributors

jschrewe avatar wpjunior avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-mongotools's Issues

Validation of embedded documents

Complete implementation of mongoengine-based forms should include validation for mongoengine.EmbeddedDocumentField.

As I saw from the source, now EmbeddedDocuments are just skipped, am I right?

filefield doesn't work

Hi

it seems that filefield doesn't work, i mean when i use such a field, it can't save in gridfs ?
is it normal ?

traces are :

Exception Type: AttributeError
Exception Value: 'InMemoryUploadedFile' object has no attribute 'grid_id'

/virtual-env/lib/python2.7/site-packages/mongoengine/fields.py in validate
return None
def to_python(self, value):
if value is not None:
return GridFSProxy(value)
def validate(self, value):
if value.grid_id is not None: # HERE THE ISSUE
assert isinstance(value, GridFSProxy)
assert isinstance(value.grid_id, pymongo.objectid.ObjectId)

Broken ReferenceField clean method in fields.py

def clean(self, oid):
    if oid in EMPTY_VALUES and not self.required:
        return None

    try:
        if self.coerce != int:
            oid = ObjectId(value)

        oid = super(ReferenceField, self).clean(oid)

        queryset = self.queryset.clone()
        obj = queryset.get(id=oid)
    except (TypeError, InvalidId, self.queryset._document.DoesNotExist):
        raise forms.ValidationError(self.error_messages['invalid_choice'] % {'value':value})
    return obj

It throws exception:

Stacktrace (most recent call last):

  File "django/core/handlers/base.py", line 111, in get_response
    response = callback(request, *callback_args, **callback_kwargs)

  File "django/views/generic/base.py", line 48, in view
    return self.dispatch(request, *args, **kwargs)

  File "django/views/generic/base.py", line 69, in dispatch
    return handler(request, *args, **kwargs)

  File "constructor/apps/admin/views.py", line 25, in post
    next = super(ChangelogMixin, self).post(request, *args, **kwargs)

  File "mongotools/views/__init__.py", line 255, in post
    return super(BaseUpdateView, self).post(request, *args, **kwargs)

  File "django/views/generic/edit.py", line 137, in post
    if form.is_valid():

  File "django/forms/forms.py", line 124, in is_valid
    return self.is_bound and not bool(self.errors)

  File "django/forms/forms.py", line 115, in _get_errors
    self.full_clean()

  File "django/forms/forms.py", line 270, in full_clean
    self._clean_fields()

  File "django/forms/forms.py", line 287, in _clean_fields
    value = field.clean(value)

  File "mongotools/forms/utils.py", line 23, in inner_validate
    value = old_clean(value)

  File "mongotools/forms/fields.py", line 93, in clean
    oid = ObjectId(value)

pymongo 2.2 is not supported

I guess In pymongo 2.2 there is not supported

No module named objectid
mongotools/forms/fields.py:4: from pymongo.objectid import ObjectId

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.