Re: Django-channels disconnects right after sending a message

2017-02-21 Thread Andrew Godwin
Then you need to add more and more back until it does disconnect and you should be able to find the line that's doing it! Andrew On Tue, Feb 21, 2017 at 11:03 PM, Nikoleta Misheva wrote: > I tried the simplest example and it works fine and does not disconnect. > > def websocket_receive(message

Re: Django-channels disconnects right after sending a message

2017-02-21 Thread Nikoleta Misheva
I tried the simplest example and it works fine and does not disconnect. def websocket_receive(message): text = message.content.get('text') if text: message.reply_channel.send({"text": "You said: {}".format(text)}) And using the JS console socket = new WebSocket("ws://" + window.location.hos

Re: Django-channels disconnects right after sending a message

2017-02-21 Thread Nikoleta Misheva
How do I log an WebsocketCloseExeption it might deliver more useful information? сряда, 22 февруари 2017 г., 3:08:09 UTC+2, Andrew Godwin написа: > > I'm afraid I don't really know what's going on then - the logs don't > reveal very much. I'd try reducing it down to simpler code until you can >

Re: Flattening model relationships (in APIs)

2017-02-21 Thread Mike Dewhirst
Ankush I think you might have to provide more than one method for retrieving an address so applications can request particular subsets. Perhaps a local-postal address, international-postal address, geo-location, what-three-words address and of course the full bucket as required. I think it i

Re: Subquery has too many columns

2017-02-21 Thread eltonplima
I tried many things, only work if I remove the annotate or remove base_manager_name. But I need both! The save method is not the problem, I removed. If the last code I posted work, then, my production code works. PS: Sorry if my English is not very good, I'm trying to improve it. On Tuesday, F

Re: Looking for Django tutorial that illustrates master/detail data models

2017-02-21 Thread Axil-Mar Imam
Hi. I wondering if you have found a way about your problem? Im actually researching on this problem as well, unfortunately, haven't found a solution to this. If you have, I would really appreciate if you share it. Thanks. On Wednesday, December 31, 2008 at 10:44:57 AM UTC+8, ldm999 wrote: > > T

Re: Subquery has too many columns

2017-02-21 Thread Melvyn Sopacua
While the testcase is simple, it is not the simplest test :) Two things come to mind: 1. If you get rid of the Sum(), does it work then? 2. Saving the model with the base_manager_name should not use that manager as related manager. It is only used when a model with a foreign key to Pro

Re: Django-channels disconnects right after sending a message

2017-02-21 Thread Andrew Godwin
I'm afraid I don't really know what's going on then - the logs don't reveal very much. I'd try reducing it down to simpler code until you can replicate it in only a few lines and work from there. Andrew On Tue, Feb 21, 2017 at 11:46 AM, Nikoleta Misheva wrote: > I don't know how to get the clos

Re: Initial data, tests and migrations

2017-02-21 Thread Melvyn Sopacua
On Tuesday 21 February 2017 19:00:42 'Tom Evans' via Django users wrote: > Previously, these instances were loaded from a JSON fixtures file, And you can still do that. > which used to be the recommended way. For our own tests, we simply > load these fixtures in the setUp portion of the test; ob

Re: Subquery has too many columns

2017-02-21 Thread eltonplima
This is part of my real code but demonstrate the issue in pratice: from django.db import models class ProdutoServicoManager(models.Manager): def get_queryset(self): custo_unitario = models.F('custounitario__valor') quantidade = models.F('custounitario__quantidade') exp

Re: Django-channels disconnects right after sending a message

2017-02-21 Thread Nikoleta Misheva
I don't know how to get the close code. It disconnects right after you hit the send button but it manages to send the message, I had prints and the message was right and etc but was always after disconnect. My disconnect function basically deletes the room. And python's console logs: [2017/02/21

Flattening model relationships (in APIs)

2017-02-21 Thread Ankush Thakur
I'm using DRF for an API. My problem is that I defined my postal address like this (breaking it up into City, State, Country): class Country(models.Model): class Meta: db_table = 'countries' name = models.TextField() code = models.TextField(unique=True) class State(models.Mod

Initial data, tests and migrations

2017-02-21 Thread 'Tom Evans' via Django users
Hi all I'm having some difficulty working out how I am supposed to provide initial data for testing purposes, particularly when the initial data is not immediately pertinent to the test. For instance, our project uses django_otp, which has some simple tests. However, these tests create user objec

Re: Django-channels disconnects right after sending a message

2017-02-21 Thread Andrew Godwin
How does it disconnect? What WebSocket close code do you get? (You'll need to add JS to log it) What prints on the Python console? Andrew On Tue, Feb 21, 2017 at 12:27 AM, Nikoleta Misheva wrote: > When I send message the websocket disconnects. I am able to get the > message, but I can't procee

KeyError on Form using datePicker

2017-02-21 Thread Baktha Muralidharan
Hello, I am new to Django framework and have run into the following issue. Any help to resolve the issue will be much appreciated. Background: I am using the jQuery datePicker to gather date input. I am able to see the calendar show on the Appointment form and am able to select a date from th

Re: combining ORM and raw SQL in same query

2017-02-21 Thread Larry Martell
Thanks. I did not know about those. On Tue, Feb 21, 2017 at 9:24 AM, Matthew Pava wrote: > I would use Case and When and other Func objects. > https://docs.djangoproject.com/en/1.10/ref/models/conditional-expressions/ > That way we don't have to depend on raw SQL. > > -Original Message-

RE: combining ORM and raw SQL in same query

2017-02-21 Thread Matthew Pava
I would use Case and When and other Func objects. https://docs.djangoproject.com/en/1.10/ref/models/conditional-expressions/ That way we don't have to depend on raw SQL. -Original Message- From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of Larry Martel

Re: Timeout when saving model in django admin page

2017-02-21 Thread Melvyn Sopacua
On Tuesday 21 February 2017 13:11:19 John, Steffen wrote: > Using celery, is it possible to prevent the user from doing other > things in the admin tool until the celery task is done? Sorta kinda. But the django admin can facilitate part of it. Look into the ModelAdmin.has_FOO_permission() metho

Re: Timeout when saving model in django admin page

2017-02-21 Thread John, Steffen
Hi, Thanks for the hint. I was already thinking about using celery, but if the process runs in background it may get some problems with other actions the user executes parallely. Using celery, is it possible to prevent the user from doing other things in the admin tool until the celery task is

Re: authenticate function is always returning none in views.py

2017-02-21 Thread Melvyn Sopacua
Your inputs don't have a "name" attribute, so I suspect your username and password are always empty. On Monday 20 February 2017 22:11:56 rocky101 wrote: > username=request.POST.get('username','') > password=request.POST.get('password','') > user = auth.authenticate(username=username,

Re: Subquery has too many columns

2017-02-21 Thread Melvyn Sopacua
On Monday 20 February 2017 17:09:40 eltonplima wrote: > Base class is abstract. > > class Base(models.Model): > plano = models.ForeignKey(Plano) > > > class Meta: > abstract = True > > > base_manager_name >

Re: Timeout when saving model in django admin page

2017-02-21 Thread Jani Tiainen
Hi, You probably want to switch to asynchronous handling of your job. Celery is one excellent tool to handle background jobs. On 21.02.2017 11:50, John, Steffen wrote: Hi! When saving the model over the admin page of Django, a lot of processing is done (in pre_save function) which takes sev

authenticate function is always returning none in views.py

2017-02-21 Thread rocky101
I'm trying to sign in with an account that already exists in the system, i checked the admin django page of my project to make sure it was there, but everytime i enter the username and password it always redirects me to the invalid webpage when I know the username and password is the exact same

Timeout when saving model in django admin page

2017-02-21 Thread John, Steffen
Hi! When saving the model over the admin page of Django, a lot of processing is done (in pre_save function) which takes several minutes. After a while I get a timeout, although the process is still running in the background. How can I avoid to get this timeout? Another nice thing would be to s

Django-channels disconnects right after sending a message

2017-02-21 Thread Nikoleta Misheva
When I send message the websocket disconnects. I am able to get the message, but I can't proceed further since disconnect is supposed to delete the room. I tested it with basic prints after every statement and it disconnects right after the receiver gets the message because everything that is i

Re: Implementing a basic search for my website

2017-02-21 Thread Carlo Ascani
Thank you for all the answers! Given that I am implementing this for a demo purpose, I do not care about performances. I think I am going to do the 2 queries approach for the demo, then I would use a FTS engine in the future. Thanks a lot Carlo Il giorno martedì 21 febbraio 2017 02:09:46 UTC