Re: Storing lists from api into database

2018-04-06 Thread James Farris
I would use the Requests module.  It's much nicer and comes loaded with 
stuff.  It's a module used to connect to API's.  Here's the docs: 
http://docs.python-requests.org/en/master/

As far as using what you have, to save it to the database is just another 
few lines of code.
You have to import the database model

from YOUR_APP.models import tesla

Then in loop in your view just add the following to save the data to the 
database:

tesla = tesla()
tesla.webUrl = data['response']['results'][i]['webUrl]
tesla.webPublicationDat = 
data['response']['results'][i]['webPublicationDate]
tesla.save()

A few things.  It's best practice to Capitalize your models( i.e. class 
Tesla, not tesla) 
If your intention is to generate an id in the id1 field, there is no need 
to have it because Django gives you an id field automatically.

On Friday, April 6, 2018 at 8:03:10 PM UTC, Mukesh Jha wrote:
>
> My main project is to collect and show the results from news site of a 
> particular topic. I have use the guardian's api and I have been given 4 
> keywords. If I click on any one of the keyword, I need to display all the 
> recent articles related to it. Now what I have understood is:
>
> import json,urllib.request
> data = json.load(urllib.request.urlopen('
> https://content.guardianapis.com/search?q=gst=test'))
> lurl=[]  #list to store the url of articles
> ldate=[]   #list to store the date of publish of url
> for i in range(0,10):
>   lurl.append(data['response']['results'][i]['webUrl'])
>   ldate.append(data['response']['results'][i]['webPublicationDate'])
> for i in range(0,10):
>   print(ldate[i]+" : ",end="")
>   print(lurl[i])
>
> Now I have to store all such values in my database and call it in views 
> page.
>
> class tesla(models.Model):
> id1=models.CharField(max_length=1)
> webTitle=models.CharField(max_length=1)
> webUrl=models.CharField(max_length=1)
> apiUrl=models.CharField(max_length=1)
> webPublicationDat=models.CharField(max_length=1)
>
> How can I do it? Please help.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/eb4b2947-7730-436f-9dae-3eafeb66e287%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Storing lists from api into database

2018-04-06 Thread James Farris
I would use the Requests module.  It's much nicer and comes loaded with 
stuff.  It's a module used to connect to API's.  Here's the docs: 
http://docs.python-requests.org/en/master/

As far as using what you have, to save it to the database is just another 
few lines of code.
You have to import the database model

from YOUR_APP import tesla

Then in loop in your view just add the following to save the data to the 
database:

tesla = tesla()
tesla.webUrl = data['response']['results'][i]['webUrl]
tesla.webPublicationDat = 
data['response']['results'][i]['webPublicationDate]
tesla.save()

A few things.  It's best practice to Capitalize your models( i.e. class 
Tesla, not tesla) 
If your intention is to generate an id in the id1 field, there is no need 
to have it because Django gives you an id field automatically.


On Friday, April 6, 2018 at 8:03:10 PM UTC, Mukesh Jha wrote:
>
> My main project is to collect and show the results from news site of a 
> particular topic. I have use the guardian's api and I have been given 4 
> keywords. If I click on any one of the keyword, I need to display all the 
> recent articles related to it. Now what I have understood is:
>
> import json,urllib.request
> data = json.load(urllib.request.urlopen('
> https://content.guardianapis.com/search?q=gst=test'))
> lurl=[]  #list to store the url of articles
> ldate=[]   #list to store the date of publish of url
> for i in range(0,10):
>   lurl.append(data['response']['results'][i]['webUrl'])
>   ldate.append(data['response']['results'][i]['webPublicationDate'])
> for i in range(0,10):
>   print(ldate[i]+" : ",end="")
>   print(lurl[i])
>
> Now I have to store all such values in my database and call it in views 
> page.
>
> class tesla(models.Model):
> id1=models.CharField(max_length=1)
> webTitle=models.CharField(max_length=1)
> webUrl=models.CharField(max_length=1)
> apiUrl=models.CharField(max_length=1)
> webPublicationDat=models.CharField(max_length=1)
>
> How can I do it? Please help.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/190437bf-a306-446f-96ec-6537f0001475%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: A first time programmer

2018-04-06 Thread James Farris
Hi,

If you type this in your terminal, you should see Django==2.0.4 (or some 
other version)

$ pip freeze

If not, Django is not installed.

Also, what is the syntax error you are receiving?

On Friday, April 6, 2018 at 10:33:39 PM UTC, Paul Baforh wrote:
>
> Please programmers, how do I engage django because i get syntax error i 
> type in this code
> - $ django-admin startproject mySite ---
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/732d0a71-22bc-4983-b335-09de5554c518%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Using other schema in PostgeSQL

2018-04-06 Thread Fabio C. Barrionuevo da Luz
This is a very old issue:


https://code.djangoproject.com/ticket/6148

https://code.djangoproject.com/ticket/7556

https://code.djangoproject.com/ticket/22673

I do not know if there is someone working on ORM and Migrations to fix this
issue.

I've seen something like this somewhere, but I do not know if it works.

class MyTable(models.Model):
# ...
class Meta:
db_table = '"correo"."mytable"'




That said, I've seen some projects that implement multi-tenancy with
Postgres Database Schemas support, but not their what black magic they use
to make it work.

I personally have never used it.

https://bitbucket.org/schinckel/django-boardinghouse

https://github.com/tomturner/django-tenants

https://github.com/bernardopires/django-tenant-schemas




2018-04-06 21:28 GMT-03:00 Michel Vega Fuenzalida :

> Hello people,
>
> I'm using PostgeSQL not using the public schema but a different one named:
> 'correo', I need to tell Django to use the that schema (I have deleted the
> public schema)
>
> Thanks
> --
> Michel Vega Fuenzalida
> Usuario Linux: 323650
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/DDE1CD0F-2A03-467A-81EF-6E6AC958017F%40nauta.cu.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Fábio C. Barrionuevo da Luz
Palmas - Tocantins - Brasil - América do Sul

http://pythonclub.com.br/

Blog colaborativo sobre Python e tecnologias Relacionadas, mantido
totalmente no https://github.com/pythonclub/pythonclub.github.io .

Todos são livres para publicar. É só fazer fork, escrever sua postagem e
mandar o pull-request. Leia mais sobre como publicar em README.md e
contributing.md.
Regra básica de postagem:
"Você" acha interessante? É útil para "você"? Pode ser utilizado com Python
ou é útil para quem usa Python? Está esperando o que? Publica logo, que
estou louco para ler...

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAPVjvMa2geTnupm%3DQFX-f-AeEO6peG0z5GZ7nr60kEEf7nGXhw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Using other schema in PostgeSQL

2018-04-06 Thread Michel Vega Fuenzalida
Hello people,

I'm using PostgeSQL not using the public schema but a different one named: 
'correo', I need to tell Django to use the that schema (I have deleted the 
public schema)

Thanks
-- 
Michel Vega Fuenzalida
Usuario Linux: 323650

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/DDE1CD0F-2A03-467A-81EF-6E6AC958017F%40nauta.cu.
For more options, visit https://groups.google.com/d/optout.


Re: A first time programmer

2018-04-06 Thread Nathaniel David
Have you tried checking the version of your Django-admin like this:
"django-admin --version" without the quotation mark. If it returns a
version number, try creating a new project like this: "django-admin
startproject royaltykitchen"

On Fri, Apr 6, 2018 at 10:43 PM, Paul Baforh  wrote:

> Please programmers, how do I engage django because i get syntax error i
> type in this code
> - $ django-admin startproject mySite ---
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/8c30cd6f-0745-44cf-a782-3cac82762a75%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Best regards,
John, Nathaniel David.
+2348034325030

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2BbJ6-1YQ%3DYp8s37U8g1N4-ChAdon5zJK8QfGgJ7OQnHqXSkjQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


A first time programmer

2018-04-06 Thread Paul Baforh
Please programmers, how do I engage django because i get syntax error i 
type in this code
- $ django-admin startproject mySite ---

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8c30cd6f-0745-44cf-a782-3cac82762a75%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Reporting for Django 2

2018-04-06 Thread jose . espina
Hi

I've been trying different django reporting packages with no success

Apparently, all of them are developed for versions previous than Django 2.0

Any help will be appreciated

José

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d176707c-b267-4730-8913-ab68b9dc64c3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Storing lists from api into database

2018-04-06 Thread Mateusz Kurowski
Maybe you should read the documentation first ? :))

2018-04-06 22:03 GMT+02:00 Mukesh Jha :

> My main project is to collect and show the results from news site of a
> particular topic. I have use the guardian's api and I have been given 4
> keywords. If I click on any one of the keyword, I need to display all the
> recent articles related to it. Now what I have understood is:
>
> import json,urllib.request
> data = json.load(urllib.request.urlopen('https://content.
> guardianapis.com/search?q=gst=test'))
> lurl=[]  #list to store the url of articles
> ldate=[]   #list to store the date of publish of url
> for i in range(0,10):
>   lurl.append(data['response']['results'][i]['webUrl'])
>   ldate.append(data['response']['results'][i]['webPublicationDate'])
> for i in range(0,10):
>   print(ldate[i]+" : ",end="")
>   print(lurl[i])
>
> Now I have to store all such values in my database and call it in views
> page.
>
> class tesla(models.Model):
> id1=models.CharField(max_length=1)
> webTitle=models.CharField(max_length=1)
> webUrl=models.CharField(max_length=1)
> apiUrl=models.CharField(max_length=1)
> webPublicationDat=models.CharField(max_length=1)
>
> How can I do it? Please help.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/84a010c6-2d11-49d9-956a-0a547870d6df%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAO_JuYN3PyMm8%3D1kPHT28WOrqJ4nSMhgY120kAQ6tjTaW%3Dj4BA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Storing lists from api into database

2018-04-06 Thread Mukesh Jha
My main project is to collect and show the results from news site of a 
particular topic. I have use the guardian's api and I have been given 4 
keywords. If I click on any one of the keyword, I need to display all the 
recent articles related to it. Now what I have understood is:

import json,urllib.request
data = json.load(urllib.request.urlopen('
https://content.guardianapis.com/search?q=gst=test'))
lurl=[]  #list to store the url of articles
ldate=[]   #list to store the date of publish of url
for i in range(0,10):
  lurl.append(data['response']['results'][i]['webUrl'])
  ldate.append(data['response']['results'][i]['webPublicationDate'])
for i in range(0,10):
  print(ldate[i]+" : ",end="")
  print(lurl[i])

Now I have to store all such values in my database and call it in views 
page.

class tesla(models.Model):
id1=models.CharField(max_length=1)
webTitle=models.CharField(max_length=1)
webUrl=models.CharField(max_length=1)
apiUrl=models.CharField(max_length=1)
webPublicationDat=models.CharField(max_length=1)

How can I do it? Please help.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/84a010c6-2d11-49d9-956a-0a547870d6df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to use Graphviz/Networkx in django?

2018-04-06 Thread shawnmhy
Thanks a lot for your help!
But since the data that needed to be visualized is already shown in the 
page, generate input file is actually not necessary. In that case, what 
should I do to make django aware that the data shown in the page is the 
'input' how can I call the tool to process the visualization?
I am sorry to ask the stupid question.I am new to django and I am 
really hope you could help me!
Thanks

在 2018年4月6日星期五 UTC+2下午7:39:43,Jani Tiainen写道:
>
> Hi,
>
> It's relatively simple. Just generate proper input file for graphwiz or 
> networkx to consume call that tool for input file and create output file. 
> Then render output file via view to your page.
>
>
> pe 6. huhtikuuta 2018 klo 18.31  
> kirjoitti:
>
>> Hi, thank you for your help.
>> But I think this link cannot really solve my problem. My question is 
>> actually how to visualize the data of my model, rather than visualize the 
>> model. 
>>
>>
>> 
>> The situation is, As you can see, the Formula detail table include the 
>> reactants that participates in the reaction, now I want to add a function 
>> to this page, like add a button at the right side. And when I click on the 
>> button, a graph could be generated automatically. The graph should looks 
>> like '10fthf5glu_m(in a circle) -> 10fthf5glu_c(in a circle)' I know this 
>> function should be done by using Graphviz and Networkx, but how?
>>
>> 在 2018年4月6日星期五 UTC+2上午10:04:31,Christian Ledermann写道:
>>>
>>> https://django-extensions.readthedocs.io/en/latest/graph_models.html 
>>>
>>> On 5 April 2018 at 19:10,   wrote: 
>>> > Hi everyone, 
>>> > If I have three models and I successfully displayed the data using 
>>> templates 
>>> > and views, how can I use graphviz or networkx to draw graph using the 
>>> data 
>>> > that I displayed? 
>>> > 
>>> > -- 
>>> > You received this message because you are subscribed to the Google 
>>> Groups 
>>> > "Django users" group. 
>>> > To unsubscribe from this group and stop receiving emails from it, send 
>>> an 
>>> > email to django-users...@googlegroups.com. 
>>> > To post to this group, send email to django...@googlegroups.com. 
>>> > Visit this group at https://groups.google.com/group/django-users. 
>>> > To view this discussion on the web visit 
>>> > 
>>> https://groups.google.com/d/msgid/django-users/0dc4b526-9643-4096-9726-6277c807b33b%40googlegroups.com.
>>>  
>>>
>>> > For more options, visit https://groups.google.com/d/optout. 
>>>
>>>
>>>
>>> -- 
>>> Best Regards, 
>>>
>>> Christian Ledermann 
>>>
>>> Newark-on-Trent - UK 
>>> Mobile : +44 7474997517 
>>>
>>> https://uk.linkedin.com/in/christianledermann 
>>> https://github.com/cleder/ 
>>>
>>>
>>> <*)))>{ 
>>>
>>> If you save the living environment, the biodiversity that we have left, 
>>> you will also automatically save the physical environment, too. But If 
>>> you only save the physical environment, you will ultimately lose both. 
>>>
>>> 1) Don’t drive species to extinction 
>>>
>>> 2) Don’t destroy a habitat that species rely on. 
>>>
>>> 3) Don’t change the climate in ways that will result in the above. 
>>>
>>> }<(((*> 
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/48cff3a7-d877-424b-9492-f4d4d34daffe%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/c13afc96-5de3-40b1-bc0f-0184b5928b52%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to use Graphviz/Networkx in django?

2018-04-06 Thread Jani Tiainen
Hi,

It's relatively simple. Just generate proper input file for graphwiz or
networkx to consume call that tool for input file and create output file.
Then render output file via view to your page.


pe 6. huhtikuuta 2018 klo 18.31  kirjoitti:

> Hi, thank you for your help.
> But I think this link cannot really solve my problem. My question is
> actually how to visualize the data of my model, rather than visualize the
> model.
>
>
> 
> The situation is, As you can see, the Formula detail table include the
> reactants that participates in the reaction, now I want to add a function
> to this page, like add a button at the right side. And when I click on the
> button, a graph could be generated automatically. The graph should looks
> like '10fthf5glu_m(in a circle) -> 10fthf5glu_c(in a circle)' I know this
> function should be done by using Graphviz and Networkx, but how?
>
> 在 2018年4月6日星期五 UTC+2上午10:04:31,Christian Ledermann写道:
>>
>> https://django-extensions.readthedocs.io/en/latest/graph_models.html
>>
>> On 5 April 2018 at 19:10,   wrote:
>> > Hi everyone,
>> > If I have three models and I successfully displayed the data using
>> templates
>> > and views, how can I use graphviz or networkx to draw graph using the
>> data
>> > that I displayed?
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups
>> > "Django users" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> an
>> > email to django-users...@googlegroups.com.
>> > To post to this group, send email to django...@googlegroups.com.
>> > Visit this group at https://groups.google.com/group/django-users.
>> > To view this discussion on the web visit
>> >
>> https://groups.google.com/d/msgid/django-users/0dc4b526-9643-4096-9726-6277c807b33b%40googlegroups.com.
>>
>> > For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>> --
>> Best Regards,
>>
>> Christian Ledermann
>>
>> Newark-on-Trent - UK
>> Mobile : +44 7474997517
>>
>> https://uk.linkedin.com/in/christianledermann
>> https://github.com/cleder/
>>
>>
>> <*)))>{
>>
>> If you save the living environment, the biodiversity that we have left,
>> you will also automatically save the physical environment, too. But If
>> you only save the physical environment, you will ultimately lose both.
>>
>> 1) Don’t drive species to extinction
>>
>> 2) Don’t destroy a habitat that species rely on.
>>
>> 3) Don’t change the climate in ways that will result in the above.
>>
>> }<(((*>
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/48cff3a7-d877-424b-9492-f4d4d34daffe%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHn91ofeW9KmQ%2BU-B0gn_FFbWWNQTMm0HKcqc7G9ttmDDKuRZw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Multiple websocket connection vs single websocket connection when using django channels

2018-04-06 Thread Ken Whitesell
Hi Robin,

I can't speak to any generalized situations, or what might be considered 
"best practices" or most optimal.

What I can say is that we have gone with the single websocket connection 
for each client - whether it's a real person at a browser or an 
application. All our communications through the channel are JSON objects, 
and we include a key named "app" in the object which identifies the 
specific "feature" or "application" to which a message is directed. It's 
done in both directions - submissions through the channel from the browsers 
to the server and from the server to the browser all have that key in the 
JSON. 

About the most I can say is that it works well for us. 

Ken

On Friday, April 6, 2018 at 5:10:41 AM UTC-4, Robin Lery wrote:
>
> Hi,
>
> Suppose an application has features like Chat, Notification and Activity 
> feeds. 
>
> I would like to know whether its recommended to have different   websocket 
> connection for different  feautues for each user. Meaning for chat purpose 
> a separate socket connection, for notification another separate connection?
>
> Or is it better to have only one websocket connection for a user, and work 
> around that single connection for different features?
>
> Sincerely,
> Robin 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/0bf0d083-1bb3-4963-905c-9e8bfce6c765%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Multiple websocket connection vs single websocket connection when using django channels

2018-04-06 Thread James Farris
I’m looking into creating an app that may utilize chat and notifications as 
well. I’m interested in what others have to say about this as well

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/f39476b5-eb31-48da-ac44-e5f53940396c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to use Graphviz/Networkx in django?

2018-04-06 Thread shawnmhy


Hi, thank you for your help.
But I think this link cannot really solve my problem. My question is 
actually how to visualize the data of my model, rather than visualize the 
model. 


The situation is, As you can see, the Formula detail table include the 
reactants that participates in the reaction, now I want to add a function 
to this page, like add a button at the right side. And when I click on the 
button, a graph could be generated automatically. The graph should looks 
like '10fthf5glu_m(in a circle) -> 10fthf5glu_c(in a circle)' I know this 
function should be done by using Graphviz and Networkx, but how?

在 2018年4月6日星期五 UTC+2上午10:04:31,Christian Ledermann写道:
>
> https://django-extensions.readthedocs.io/en/latest/graph_models.html 
>
> On 5 April 2018 at 19:10,   wrote: 
> > Hi everyone, 
> > If I have three models and I successfully displayed the data using 
> templates 
> > and views, how can I use graphviz or networkx to draw graph using the 
> data 
> > that I displayed? 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "Django users" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to django-users...@googlegroups.com . 
> > To post to this group, send email to django...@googlegroups.com 
> . 
> > Visit this group at https://groups.google.com/group/django-users. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/django-users/0dc4b526-9643-4096-9726-6277c807b33b%40googlegroups.com.
>  
>
> > For more options, visit https://groups.google.com/d/optout. 
>
>
>
> -- 
> Best Regards, 
>
> Christian Ledermann 
>
> Newark-on-Trent - UK 
> Mobile : +44 7474997517 
>
> https://uk.linkedin.com/in/christianledermann 
> https://github.com/cleder/ 
>
>
> <*)))>{ 
>
> If you save the living environment, the biodiversity that we have left, 
> you will also automatically save the physical environment, too. But If 
> you only save the physical environment, you will ultimately lose both. 
>
> 1) Don’t drive species to extinction 
>
> 2) Don’t destroy a habitat that species rely on. 
>
> 3) Don’t change the climate in ways that will result in the above. 
>
> }<(((*> 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/48cff3a7-d877-424b-9492-f4d4d34daffe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Attribute error at /admin/ by Django

2018-04-06 Thread Melvyn Sopacua
On vrijdag 6 april 2018 09:05:20 CEST Hamroz Jumaev wrote:
> http://dpaste.com/2GDFCG8
No middleware.

-- 
Melvyn Sopacua

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/56429012.RfAilTTXfn%40fritzbook.
For more options, visit https://groups.google.com/d/optout.


Experiences using the zappa.

2018-04-06 Thread Leonardo da Costa Santos
Good morning, I would to be know about the use of zappa + RDS. I am having 
many problems with this, each user generates an instance and an instance is 
a connection to the database, I easily overflow the number of connections.

Has anyone ever had this problem?


--
Leonardo C. Santos

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6038fc6e-3888-4f23-8fae-e2031b201543%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: widget rendering custom html

2018-04-06 Thread Stefano Tranquillini
The problem was that I've used cispy-form and apparently they don't work as 
expected.

PS: i wrote a post about how I modified the widget and the rest to make it 
look different, 
https://stefanotranquillini.wordpress.com/2018/04/03/beautiful-django-widget-for-multi-selection/

On Tuesday, March 27, 2018 at 10:31:46 AM UTC+2, Stefano Tranquillini wrote:
>
> Hi all,
>
> I would like to personlize a widget adding an extra link. In particular I 
> want to change the forms.widgets.CheckboxSelectMultiple .
> I've read this: https://docs.djangoproject.com/en/2.0/ref/forms/renderers/  
> but I can't still make it working, I did this piece of code
>
> class MultiChoiceFilterWidget(forms.widgets.CheckboxSelectMultiple):
>  template_name = 'web_admin/partial/checkbox.html'
>
> class PurposesChoiceForm(ModelForm):
>
> class Meta:
>  model = MyModel
>  fields = ('myField',)
>  widgets = {
>  'myField': forms.widgets.CheckboxSelectMultiple,
>  }
>
>
> (indented correctly)
>
> However, there's no way to make it running, what else should I do?
>
> I also tried to put the .html directly inside my app template folder such 
> as web/template/django/forms/widget/checkbox.html but with no luck.
>
> does anyone can point me to a working example or tutorial?
>
> do I've to setup the TemplatesSetting or is there another way to do it?
>
>
> PS: i would like to personlize the widget just for this form, and not for 
> all the forms.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/990f1253-4a35-4b2f-846d-c56b76aa9a55%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Channels 2.0 max number of connections

2018-04-06 Thread Алексей Кузуб
Or I was wrong and the solution is using "from twisted.internet import 
iocpreactor" instead of "from twisted.internet import reactor"

пятница, 6 апреля 2018 г., 12:32:19 UTC+3 пользователь Алексей Кузуб 
написал:
>
> Thank you, Andrew!
> I try to simulate 1.000 connections and I got exception ValueError: too 
> many file descriptors in select(). I use Windows OS.
> I found the solution of this problem here 
> https://docs.python.org/3/library/asyncio-eventloops.html#asyncio.ProactorEventLoop
> Is there some way to use it with Channels and Daphne?
>
> четверг, 5 апреля 2018 г., 9:41:30 UTC+3 пользователь Andrew Godwin 
> написал:
>>
>> No, there is no hard limit programmed into Daphne. It will keep accepting 
>> as long as it can.
>>
>> Andrew
>>
>> On Wed, Apr 4, 2018 at 11:30 PM, Алексей Кузуб  wrote:
>>
>>> But no limit in params or in some other place?
>>>
>>> среда, 4 апреля 2018 г., 20:00:11 UTC+3 пользователь Andrew Godwin 
>>> написал:

 It depends on your server and how busy the connections are. If you need 
 more you should run more instances of Daphne.

 Andrew

 On Wed, 4 Apr 2018, 05:21 Алексей Кузуб,  wrote:

> Hello! How many connections Channels 2.0 can handle and keep open 
> simultaneously? And how should I configure Daphne that increases this 
> number?
>
> -- 
> You received this message because you are subscribed to the Google 
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send 
> an email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/641b59f8-ed76-4a08-a7f2-06963e7d183f%40googlegroups.com
>  
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
 -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to django-users...@googlegroups.com.
>>> To post to this group, send email to django...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/django-users/9602d8c9-3316-4455-b14c-9da9e20217b8%40googlegroups.com
>>>  
>>> 
>>> .
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a3761dce-6ffe-406c-b0fc-a4dd952d87fa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Attribute error at /admin/ by Django

2018-04-06 Thread Hamroz Jumaev
http://dpaste.com/2GDFCG8

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/fee7278a-3be9-494f-a8df-c86724d24058%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Channels 2.0 max number of connections

2018-04-06 Thread Алексей Кузуб
Thank you, Andrew!
I try to simulate 1.000 connections and I got exception ValueError: too 
many file descriptors in select(). I use Windows OS.
I found the solution of this problem here 
https://docs.python.org/3/library/asyncio-eventloops.html#asyncio.ProactorEventLoop
Is there some way to use it with Channels and Daphne?

четверг, 5 апреля 2018 г., 9:41:30 UTC+3 пользователь Andrew Godwin написал:
>
> No, there is no hard limit programmed into Daphne. It will keep accepting 
> as long as it can.
>
> Andrew
>
> On Wed, Apr 4, 2018 at 11:30 PM, Алексей Кузуб  > wrote:
>
>> But no limit in params or in some other place?
>>
>> среда, 4 апреля 2018 г., 20:00:11 UTC+3 пользователь Andrew Godwin 
>> написал:
>>>
>>> It depends on your server and how busy the connections are. If you need 
>>> more you should run more instances of Daphne.
>>>
>>> Andrew
>>>
>>> On Wed, 4 Apr 2018, 05:21 Алексей Кузуб,  wrote:
>>>
 Hello! How many connections Channels 2.0 can handle and keep open 
 simultaneously? And how should I configure Daphne that increases this 
 number?

 -- 
 You received this message because you are subscribed to the Google 
 Groups "Django users" group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to django-users...@googlegroups.com.
 To post to this group, send email to django...@googlegroups.com.
 Visit this group at https://groups.google.com/group/django-users.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/django-users/641b59f8-ed76-4a08-a7f2-06963e7d183f%40googlegroups.com
  
 
 .
 For more options, visit https://groups.google.com/d/optout.

>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/9602d8c9-3316-4455-b14c-9da9e20217b8%40googlegroups.com
>>  
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/50bd42a4-7110-4205-8f9b-32529663db3a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Multiple websocket connection vs single websocket connection when using django channels

2018-04-06 Thread Robin Lery
Hi,

Suppose an application has features like Chat, Notification and Activity
feeds.

I would like to know whether its recommended to have different   websocket
connection for different  feautues for each user. Meaning for chat purpose
a separate socket connection, for notification another separate connection?

Or is it better to have only one websocket connection for a user, and work
around that single connection for different features?

Sincerely,
Robin

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2B4-nGotWh6waiNPdTbH85%3DM0mPPKnh1%3DHR4BdYBsrUCFB6WPg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Cache a ModelChoiceField queryset in a FormSet

2018-04-06 Thread jxrossel
Since nobody gave a feedback, let me provide a link to the solution I came 
up with, in case anybody is interested: 
https://stackoverflow.com/a/49689142/2775385

Le mercredi 28 mars 2018 07:41:34 UTC+2, jxro...@gmail.com a écrit :
>
> Hi,
>
> I am using a ModelChoiceField in a simple FormSet (not a ModelFormSet). 
> When rendering the FormSet, Django duplicates the ModelChoiceField queryset 
> for each row of the FormSet and repeats the same query multiple times to 
> fill the select boxes. Is there a standard solution to cache the 
> ModelChoiceField queryset after the first query and re-use it for the rows 
> 2 to N ?
>
> I have found these solutions 
> 
>  or 
> this one 
> ,
>  
> but they look like ugly hacks to me.
>
> Any help appreciated!
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/3b8743cb-feb1-4ef3-a7cf-62d762066b03%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to use Graphviz/Networkx in django?

2018-04-06 Thread Christian Ledermann
https://django-extensions.readthedocs.io/en/latest/graph_models.html

On 5 April 2018 at 19:10,   wrote:
> Hi everyone,
> If I have three models and I successfully displayed the data using templates
> and views, how can I use graphviz or networkx to draw graph using the data
> that I displayed?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/0dc4b526-9643-4096-9726-6277c807b33b%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
Best Regards,

Christian Ledermann

Newark-on-Trent - UK
Mobile : +44 7474997517

https://uk.linkedin.com/in/christianledermann
https://github.com/cleder/


<*)))>{

If you save the living environment, the biodiversity that we have left,
you will also automatically save the physical environment, too. But If
you only save the physical environment, you will ultimately lose both.

1) Don’t drive species to extinction

2) Don’t destroy a habitat that species rely on.

3) Don’t change the climate in ways that will result in the above.

}<(((*>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CABCjzWoxR0wz-62vfVi-Ukuv%3D9v132P78vfyb4QVUjSruMaJSA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.