These are chat archives for django/django

9th
Sep 2015
Peter Bittner
@bittner
Sep 09 2015 07:07
Hi there, has anyone of you come across an issue with {% endspaceless %} in templates in Django 1.8? It's not recognized anymore, but it's still in the Django docs.
Sudheesh Singanamalla
@sudheesh001
Sep 09 2015 07:21

Hey @bittner I've just tried it out and it seems to be working with Django==1.8.4
The following snippet

{% spaceless %}
    <p>
        <a href="foo/">Foo</a>
    </p>
{% endspaceless %}

does convert itself to <p><a href="foo/">Foo</a></p> but having text immediately doesn't

{% spaceless %}
<strong>
            Hello
</strong>
{% endspaceless %}

This content renders with the space present as it is, According to the documentation, spaces between tags and text isn't removed. https://docs.djangoproject.com/en/1.8/ref/templates/builtins/#spaceless
I hope this helps

Mir Nazim
@mnazim
Sep 09 2015 07:22
@bittner are your using django-sekizai?
@bittner found this on google ojii/django-sekizai#30.
Peter Bittner
@bittner
Sep 09 2015 07:28
Yes, sekizai with django CMS 3.2
Ah, that could be it. Thanks bunches, @mnazim!
Sudheesh Singanamalla
@sudheesh001
Sep 09 2015 07:40
Hi pythonistas, Has anyone tried to include both MySQL & MongoD into the same django project ? If yes, How do we set it up ? I want to use the MySQL DB for storing registration data and other details, and MongoDB to track real time data of location coming from a user ? Is there any other way to track GPS location of users using the app in real time other than using web sockets ?
kdelinx
@kdelinx
Sep 09 2015 08:52
use a Master/Slave database settings
Peter Bittner
@bittner
Sep 09 2015 09:50
Thanks @sudheesh001 for confirming that it works with Django 1.8 in general.
Sudheesh Singanamalla
@sudheesh001
Sep 09 2015 10:35
@kdelinx Thank you so much. One thing i've noticed is that django https://github.com/django-nonrel for syncing MongoDB uses django == 1.6.* instead of 1.8, Is there a way I can keep 1.8 and still use MongoDB as a slave DB
kdelinx
@kdelinx
Sep 09 2015 10:56
@sudheesh001 Do you need using an ORM? One of the variant - is use a native query to mongoDB, and second - to search module for it.
Sudheesh Singanamalla
@sudheesh001
Sep 09 2015 11:01

@kdelinx Yes I want to use the ORM both for the MySQL as well as the MongoDB parts of my models, I am using that plugin and I end up receiving the following error

    'The SchemaEditorClass attribute of this database wrapper is still None')
NotImplementedError: The SchemaEditorClass attribute of this database wrapper is still None

when I migrate, but the same when I fall to django-nonrel it changes my django to 1.6.* and this ORM works perfectly then

Mir Nazim
@mnazim
Sep 09 2015 11:02

Hello guys, I am try to run following query against haystack (elasticsearch backend)

sqs = SearchQuerySet().filter( SQ(name=AutoQuery("abc")) | SQ(about=AutoQuery("xyz")) )

I am getting following error.

: Parse Failure [Failed to parse source [{"query": {"filtered": {"filter": {"terms": {"django_ct": ["organizations.organization"]}}, "query": {"query_string": {"query": "( OR (name:(abc) OR about:(xyz)))", "default_operator": "OR", "default_field": "text", "auto_generate_phrase_queries": true, "analyze_wildcard": true}}}}, "from": 0, "size": 10}]]]; nested: QueryParsingException[[org_index] Failed to parse query [( OR (name:(sabc) OR about:(xyz)))]]; nested: ParseException[Cannot parse \'( OR (name:(sabc) OR about:(xyz)))\': Encountered " <OR> "OR "" at line 1, column 2.\nWas expecting one of:\n    <NOT> ...\n    "+" ...\n    "-" ...\n    <BAREOPER> ...\n    "(" ...\n    "*" ...\n    <QUOTED> ...\n    <TERM> ...\n    <PREFIXTERM> ...\n    <WILDTERM> .

Anyone have an idea what’s going on here?

kdelinx
@kdelinx
Sep 09 2015 11:05
@sudheesh001 show here your DATABASES = { ... } blocks
Sudheesh Singanamalla
@sudheesh001
Sep 09 2015 11:07
DATABASES = {
    'default': {
        'ENGINE':'django.db.backends.mysql',
        'NAME': 'MYDBNAME',
        'USER': 'username',
        'PASSWORD': 'password',
        'HOST': 'localhost',
    },
    'nosql': {
        'ENGINE' : 'django_mongodb_engine',
        'NAME' : 'geoDB',
        'PORT' : 27017,
        'HOST' : 'localhost',
    }
}
kdelinx
@kdelinx
Sep 09 2015 11:11
So... It should be work
Did you add 'djangotoolbox' to INSTALLED_APPS?
Sudheesh Singanamalla
@sudheesh001
Sep 09 2015 11:15
Yup i did, still the same error
    'The SchemaEditorClass attribute of this database wrapper is still None')
NotImplementedError: The SchemaEditorClass attribute of this database wrapper is still None
Mir Nazim
@mnazim
Sep 09 2015 11:29
This message was deleted

Hello guys, I am try to run following query against haystack (elasticsearch backend)

sqs = SearchQuerySet().filter( SQ(name=AutoQuery("abc")) | SQ(about=AutoQuery("xyz")) )

I am getting following error.

: Parse Failure [Failed to parse source [{"query": {"filtered": {"filter": {"terms": {"django_ct": ["organizations.organization"]}}, "query": {"query_string": {"query": "( OR (name:(abc) OR about:(xyz)))", "default_operator": "OR", "default_field": "text", "auto_generate_phrase_queries": true, "analyze_wildcard": true}}}}, "from": 0, "size": 10}]]]; nested: QueryParsingException[[org_index] Failed to parse query [( OR (name:(sabc) OR about:(xyz)))]]; nested: ParseException[Cannot parse \'( OR (name:(sabc) OR about:(xyz)))\': Encountered " <OR> "OR "" at line 1, column 2.\nWas expecting one of:\n    <NOT> ...\n    "+" ...\n    "-" ...\n    <BAREOPER> ...\n    "(" ...\n    "*" ...\n    <QUOTED> ...\n    <TERM> ...\n    <PREFIXTERM> ...\n    <WILDTERM> .

Anyone have an idea what’s going on here?

And seems like I am not getting parse error if I use filter without AutoQuery

Oleg Serbokryl
@Krokop
Sep 09 2015 20:05
Hi all, how correct return mp3 with Django?