# Path: moma_django/exceptions.py
# class MongoQuerySetExeption(Exception):
#     pass


from types import DictType
from .exceptions import MongoQuerySetExeption
from datetime import datetime, date
        params = self.filter.split('__')
        name = params[0]
        return name

    def construct_spec(self, negate, filter, value, additional_options):
        if filter and filter != self.COLON:
            spec = {filter: value}
            if negate:
                spec = {self.negate_lookup[filter]: value}
            if additional_options:
                spec.update(additional_options)
        else:
            if negate:
                spec = {self.NE: value}
            else:
                spec = value
        return spec

    def _analyze_field_lookups(self, model):
        params = self.filter.split('__')
        if len(params) > 3:
            raise MongoQuerySetExeption('Does not support related objects filtering. Only be related field.')
        elif len(params) == 3:
            meta_field = model._meta.get_field(params[0])
            rel = meta_field.rel
            #this is field that saved as FK in MongoModel so we can filter by this field
            if rel:
                if params[1] == rel.field_name:
                    lookup = params[2]
                else:

# Path: moma_django/exceptions.py
# class MongoQuerySetExeption(Exception):
#     pass


# Path: moma_django/query_utils.py
from types import DictType
from .exceptions import MongoQuerySetExeption
from datetime import datetime, date

        params = self.filter.split('__')
        name = params[0]
        return name

    def construct_spec(self, negate, filter, value, additional_options):
        if filter and filter != self.COLON:
            spec = {filter: value}
            if negate:
                spec = {self.negate_lookup[filter]: value}
            if additional_options:
                spec.update(additional_options)
        else:
            if negate:
                spec = {self.NE: value}
            else:
                spec = value
        return spec

    def _analyze_field_lookups(self, model):
        params = self.filter.split('__')
        if len(params) > 3:
            raise MongoQuerySetExeption('Does not support related objects filtering. Only be related field.')
        elif len(params) == 3:
            meta_field = model._meta.get_field(params[0])
            rel = meta_field.rel
            #this is field that saved as FK in MongoModel so we can filter by this field
            if rel:
                if params[1] == rel.field_name:
                    lookup = params[2]
                else:

                    raise MongoQuerySetExeption('Does not support related objects filtering. Only be related field.')