Re: Restricting the user from closing the browser tab so that the server side APIs are called.

2017-05-31 Thread Fred Stluka
Rahul, I don't think you're going to find a reliable way to ensure that the APIs are called from the browser.  There are too many ways for the user to close the browser, or for the browser to crash, or for the browser to lose connectivity to the server

Re: Restricting the user from closing the browser tab so that the server side APIs are called.

2017-05-31 Thread Melvyn Sopacua
On Wednesday 31 May 2017 14:05:14 Rahul Paul wrote: > We are working on a django project in which we are developing a two > way audio visual solution for the users. Now we have certain set of > APIs that need to be called from JavaScript through ajax request when > user ends the call through our

Re: ModelFormset Into InlineFormset

2017-05-31 Thread James Schneider
On Wed, May 31, 2017 at 3:13 PM, Matthew Pava wrote: > I have a class CustomFormSet that inherits from BaseModelFormSet. I would > like to have another formset class that does everything CustomFormSet does > but instead inherits from BaseInlineFormSet. What is the best >

Re: count from multiple tables in a single query?

2017-05-31 Thread James Schneider
On Wed, May 31, 2017 at 3:01 PM, Alceu Rodrigues de Freitas Junior < alceu.freitas...@gmail.com> wrote: > Hi James, > > I'm curious... why dropping down from the ORM and doing a single query > wouldn't be portable? > > I understand that it would happen if you use some kind of stored procedure >

ModelFormset Into InlineFormset

2017-05-31 Thread Matthew Pava
I have a class CustomFormSet that inherits from BaseModelFormSet. I would like to have another formset class that does everything CustomFormSet does but instead inherits from BaseInlineFormSet. What is the best pythonic/Django way of doing that? -- You received this message because you are

Re: count from multiple tables in a single query?

2017-05-31 Thread Alceu Rodrigues de Freitas Junior
Hi James, I'm curious... why dropping down from the ORM and doing a single query wouldn't be portable? I understand that it would happen if you use some kind of stored procedure in the DB, but I guess a single ANSI SQL would do it. Thanks! - Alceu Em 31/05/2017 17:29, James Schneider

Re: count from multiple tables in a single query?

2017-05-31 Thread 'Abraham Varricatt' via Django users
Hello James/Matthew, I was afraid to hear that. The models are unrelated and I do not want to take the trouble of dropping out of the ORM. Since it's a web-service I'm building, a work-around is to cache results, but I was challenged to find a single DB call solution and wanted to be sure that

Restricting the user from closing the browser tab so that the server side APIs are called.

2017-05-31 Thread Rahul Paul
Hi, We are working on a django project in which we are developing a two way audio visual solution for the users. Now we have certain set of APIs that need to be called from JavaScript through ajax request when user ends the call through our end-call button. Some of these ajax calls are

RE: count from multiple tables in a single query?

2017-05-31 Thread Matthew Pava
Hi Abraham, If the models are related, you can use double underscore notation with the Count aggregate function. If the models are unrelated, then I’m fairly certain that you can only use separate queries to get your results. From: 'Abraham Varricatt' via Django users

Re: count from multiple tables in a single query?

2017-05-31 Thread James Schneider
> > > If I want to get the total count from both tables it can be done like this, > > author_count = Author.objects.count() > publisher_count = Publisher.objects.count() > > My concern is that this results in two different queries to the database. > Can it be done with a single query call? > >

count from multiple tables in a single query?

2017-05-31 Thread 'Abraham Varricatt' via Django users
Hello, Is it possible to get the count of entries from multiple tables in a single query call? I'm looking at the official docs on aggregation and I can't find anything. For example assume I have the following 2 tables, class Author(models.Model): name = models.CharField(max_length=100)

Re: value of checkbox aren't saved in the form

2017-05-31 Thread 'Tom Evans' via Django users
Your checkbox fields on the form are "market" and "sector", but your "Parameters" model doesn't have fields with those names, and you aren't doing anything with the values from the form in your save() method. Where were you expecting those checkboxes to be saved? Cheers Tom On Wed, May 31,

Re: Django db backend not FIPS compliant

2017-05-31 Thread Tim Graham
django-developers discussion: https://groups.google.com/d/msg/django-developers/dlUIPzQgnpM/Mtl7CQbPAQAJ On Tuesday, May 30, 2017 at 5:06:23 PM UTC-4, Tim Graham wrote: > > This usage generates a short, unique identifier for a database index name. > The usage of md5 here isn't security

Re: django.db.utils.OperationalError: server closed the connection unexpectedly

2017-05-31 Thread Antonis Christofides
It's because you don't have PostgreSQL installed. The LitDB instructions say, among other things, "Make sure that you have a PostgreSQL database running and that you have permissions to create tables in that database". The LitDB installation instructions are quite brief, which is probably fine

Re: django.db.utils.OperationalError: server closed the connection unexpectedly

2017-05-31 Thread Bobby Paul
Dear Antonis, Thank you very much for your quick response. Sorry, I am newer in this field. I was trying to install LitDB (http://www.ikmb.uni-kiel.de/litdb) I changed the settings as what your suggestion, but not happened. with port number 5432, it showing Is the server running on host

value of checkbox aren't saved in the form

2017-05-31 Thread farah_chaaban
i am a beginner with Django. I don''t know what the problem with the value of checkbox. When i enter to the saved form the value of checkbox aren't save.The image is here . Please I need your help, I loose too much time on this. This is my forms.py:

Re: django.db.utils.OperationalError: server closed the connection unexpectedly

2017-05-31 Thread Antonis Christofides
Hello, > DATABASES_DEFAULT = { > > 'ENGINE': 'django.db.backends.postgresql_psycopg2', > 'NAME': 'litdb', > 'USER': 'root', > 'PASSWORD': '', > 'HOST': 'localhost', > 'PORT': '80', > } First, if this means what I think it means, it's a very nasty

django.db.utils.OperationalError: server closed the connection unexpectedly

2017-05-31 Thread Bobby Paul
Dear All, I am getting this error message while trying to install psql database. File "setup.py", line 18, in execute_from_command_line(['manage.py','migrate']) File "/usr/local/bin/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute_from_command_line