Re: channels v2.0.0 disconnect function not triggering

2018-02-06 Thread Andrew Godwin
You are not using it incorrectly - this is a known issue:
https://github.com/django/daphne/issues/152

Andrew

On Mon, Feb 5, 2018 at 11:53 PM, Ahmed Magdy  wrote:

> It seems like I cannot get the disconnect function in the consumer to get
> called at all.
>
> class ChatConsumer(WebsocketConsumer):
>def connect(self):
>self.accept()
>
> def disconnect(self):
>print('disconnected')
>
> Using self.close from the consumer, or closing the javascript websocket
> doesn't trigger the print at all, though it does write in the log that the
> websocket disconnected.
>
> [2018/02/06 09:50:32] WebSocket HANDSHAKING /sessions/ [127.0.0.1:7854]
> [2018/02/06 09:50:32] WebSocket CONNECT /sessions/ [127.0.0.1:7854]
> [2018/02/06 09:50:39] WebSocket DISCONNECT /sessions/ [127.0.0.1:7854]
>
> Am I using it incorrectly?
>
> --
> 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/520a3775-4a2b-4f9d-959f-bbe13491f6ab%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/CAFwN1upr3hO106DMDPCvZLTfjocA5WB%2BuWyFd8MT43WgsiBJ7Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: chemistry character set

2018-02-06 Thread Jason
At first glance, I thought this was an easy problem to have, but apparently 
it is certainly not!  I came across an Oracle whitepaper 

 that 
describes how to sort your linguistic data, and you might find some clues 
there to adapt with your current db.  
http://ilmarkerm.blogspot.com/2009/07/using-linguistic-indexes-for-sorting-in.html
 is 
an old post describing linguistic indexes in postgres and mysql, but the 
dbs used are almost 8 years out of date, so you might have to update the 
syntax to your current version.

On Monday, February 5, 2018 at 6:56:00 PM UTC-5, Mike Dewhirst wrote:
>
> Chemical names start with both upper and lower case as well as Greek 
> characters. Chemical names also exist in multiple non-western non-latin 
> languages. 
>
> To get lists of chemicals sorting more or less "correctly" I currently 
> slugify with allow_unicode=True. 
>
> This for example gets tert-Butyl... sorted nicely among names starting 
> with upper-case T. 
>
> Unfortunately the α-terpineol or beta this or  ε that all sink to the 
> end of the list instead of sorting into the A, B or Es. 
>
> My google-fu indicates I can sort on a property but that is slow. I have 
> thought about tweaking slugify to include a table of equivalences 
> between Greek and Western chars but that doesn't necessarily cater for 
> non-Western character sets. Maybe an ever expanding table of equivalences? 
>
> Thanks for any ideas ... 
>
> Mike 
>
>

-- 
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/1a1ad0d7-f6b5-4397-beb4-0f15964cabf2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: chemistry character set

2018-02-06 Thread Julio Biason
Hi Mike,

One thing that occurs me is that you can override the model save() to
update another field -- one that the user doesn't have access. On that
function, you will write a new field, say `sortable_name` in which you'll
transfor the chemical name into something that will appear in the proper
order, like converting alphas to A, betas to B, etc.

When you request the list of chemicals by name order, you actually use the
`sortable_name` field, which will have all the conversions in place.

On Mon, Feb 5, 2018 at 9:55 PM, Mike Dewhirst  wrote:

> Chemical names start with both upper and lower case as well as Greek
> characters. Chemical names also exist in multiple non-western non-latin
> languages.
>
> To get lists of chemicals sorting more or less "correctly" I currently
> slugify with allow_unicode=True.
>
> This for example gets tert-Butyl... sorted nicely among names starting
> with upper-case T.
>
> Unfortunately the α-terpineol or beta this or  ε that all sink to the end
> of the list instead of sorting into the A, B or Es.
>
> My google-fu indicates I can sort on a property but that is slow. I have
> thought about tweaking slugify to include a table of equivalences between
> Greek and Western chars but that doesn't necessarily cater for non-Western
> character sets. Maybe an ever expanding table of equivalences?
>
> Thanks for any ideas ...
>
> Mike
>
> --
> 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/ms
> gid/django-users/4160ee4d-8b36-1118-1bec-2ba8ab40d891%40dewhirst.com.au.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
*Julio Biason*, Sofware Engineer
*AZION*  |  Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51
*99907 0554*

-- 
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/CAEM7gE1%3DDRwnaOjJhf63EPXzjKGv083M-NNwCN7%2BfhbgeZRz-Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: chemistry character set

2018-02-06 Thread Mike Dewhirst

On 6/02/2018 10:27 PM, Julio Biason wrote:

Hi Mike,

One thing that occurs me is that you can override the model save() to 
update another field -- one that the user doesn't have access. On that 
function, you will write a new field, say `sortable_name` in which 
you'll transfor the chemical name into something that will appear in 
the proper order, like converting alphas to A, betas to B, etc.


Agreed. This is what I have done to date ...

In substance.save() ...

self.slug = greek_tweak(self.name, allow_unicode=True)

substance.slug is not displayed anywhere and nor is it used in urls 
because there can be many substances with the same name. And 
greek_tweak() ...


def greek_tweak(name, allow_unicode=True):
name = name.replace('α', 'a').replace('β', 'b').replace('γ', 'g')
name = name.replace('δ', 'd').replace('ε', 'e')
return slugify(name, allow_unicode)

And back in substance Meta ...

ordering = ['slug']




When you request the list of chemicals by name order, you actually use 
the `sortable_name` field, which will have all the conversions in place.


On Mon, Feb 5, 2018 at 9:55 PM, Mike Dewhirst > wrote:


Chemical names start with both upper and lower case as well as
Greek characters. Chemical names also exist in multiple
non-western non-latin languages.

To get lists of chemicals sorting more or less "correctly" I
currently slugify with allow_unicode=True.

This for example gets tert-Butyl... sorted nicely among names
starting with upper-case T.

Unfortunately the α-terpineol or beta this or  ε that all sink to
the end of the list instead of sorting into the A, B or Es.

My google-fu indicates I can sort on a property but that is slow.
I have thought about tweaking slugify to include a table of
equivalences between Greek and Western chars but that doesn't
necessarily cater for non-Western character sets. Maybe an ever
expanding table of equivalences?

Thanks for any ideas ...

Mike

-- 
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/4160ee4d-8b36-1118-1bec-2ba8ab40d891%40dewhirst.com.au

.
For more options, visit https://groups.google.com/d/optout
.




--
*Julio Biason*,Sofware Engineer
*AZION*  | Deliver. Accelerate. Protect.
Office: +55 51 3083 8101   |  Mobile: +55 51 
_99907 0554_

--
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/CAEM7gE1%3DDRwnaOjJhf63EPXzjKGv083M-NNwCN7%2BfhbgeZRz-Q%40mail.gmail.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/358d35a3-86d6-52e0-2c34-7382b73b7342%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Re: chemistry character set

2018-02-06 Thread Mike Dewhirst

On 6/02/2018 10:08 PM, Jason wrote:
At first glance, I thought this was an easy problem to have, but 
apparently it is certainly not!  I came across an Oracle whitepaper 
 that 
describes how to sort your linguistic data, and you might find some 
clues there to adapt with your current db. 
http://ilmarkerm.blogspot.com/2009/07/using-linguistic-indexes-for-sorting-in.html is 
an old post describing linguistic indexes in postgres and mysql, but 
the dbs used are almost 8 years out of date, so you might have to 
update the syntax to your current version.


Thank you. I think this is where we probably need to go. I asked the 
original question because I'm hoping the project will reach a tipping 
point and start to accumulate a growing number of multilingual users. We 
have our first multinational user but they only operate in the English 
speaking world so no pressure at the moment.


I really appreciate that pointer

Cheers

Mike



On Monday, February 5, 2018 at 6:56:00 PM UTC-5, Mike Dewhirst wrote:

Chemical names start with both upper and lower case as well as Greek
characters. Chemical names also exist in multiple non-western
non-latin
languages.

To get lists of chemicals sorting more or less "correctly" I
currently
slugify with allow_unicode=True.

This for example gets tert-Butyl... sorted nicely among names
starting
with upper-case T.

Unfortunately the α-terpineol or beta this or  ε that all sink to the
end of the list instead of sorting into the A, B or Es.

My google-fu indicates I can sort on a property but that is slow.
I have
thought about tweaking slugify to include a table of equivalences
between Greek and Western chars but that doesn't necessarily cater
for
non-Western character sets. Maybe an ever expanding table of
equivalences?

Thanks for any ideas ...

Mike

--
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/1a1ad0d7-f6b5-4397-beb4-0f15964cabf2%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/fa164b82-3a6d-928a-3da3-9770681eebaf%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.


Dynamic creation of models

2018-02-06 Thread Marc
 

Hello

 

Currently working on a project to allow researchers to upload data files 
into a repository. The system will only handle the import, validation and 
transformation of the data, so that it meets the required standards. When a 
file is upload the for the first time the user has to be able to define the 
structure of the destination based on the csv/xls. This includes key field, 
data types, foreign keys etc. There is no requirement for the data to be 
displayed or edited once in the repository by this system, currently. We 
are currently planning on using PostgreSQL as the database.

 

Our organisation already has another system, with a similar requirement, 
that is partially written by an external contractor in Ruby on Rails. The 
dynamic creation of the tables is no problem but it is the dynamic creation 
of the models and controllers that is proving difficult and is the reason 
why this other project is not finished. 

 

Reading through the forums it looks like Django may offer a better solution 
through meta-programming. https://code.djangoproject.com/wiki/DynamicModels 
This does look like quite an old article though. 

 

The other solution would be to have one table that holds all the records 
for all the imported files and have a JSONB (in PostgreSQL) to hold the 
columns that differ between files. This means that we would not be able to 
represent the relationships between files though. Ideally the organisation 
would like the data in a relational form to make subsequent analysis with 
other tools easier.

 

Above all it is important that the system is robust and maintainable. Any 
solution will of course be tested by creating a proof of concept first.

 

Is it still possible to dynamically create the models in the latest 
versions of Django (1.11 and 2.02)? 

 

Thank you

Marc

-- 
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/d707e803-3dbf-43e6-95a8-13869043c280%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Please support Django Girls Fundraising Campaign (sorry for irrelevant topic in this group)

2018-02-06 Thread Anna Makarudze


Hello all,


My name is Anna Makarudze. I am the Django Girls Foundation Fundraising 
Coordinator.


I would like to take this opportunity to inform you about the crowdfunding 
project we launched this week to raise funds which we need to continue our 
work in bringing in more women to coding. Since Django Girls was started 
three years ago, over 12,000 women have attended our workshops and learnt 
to code using Python and Django. We would like to continue growing the 
number in 2018. We are running our fundraising project through crowdfunding 
on Indiegogo Generosity, an online crowdfunding platform (
https://www.generosity.com/community-fundraising/django-girls-fundraising-campaign/x/17493288).
 
Our target is to raise USD 10,000 in four to six weeks through corporate 
sponsorships and crowdfunding. We are hoping you will support us and help 
us reach our goal.

If your company is interested in corporate sponsorship, please contact me 
and I will share with you our Sponsors Deck for 2018 which contains 
information about our corporate sponsorship packages. We hope you can share 
the within your organisation as well as spread the word about the campaign 
to your friends, family and colleagues.


Please feel free to ask me any questions you may have.

Thank you.


P.S Sorry for the post which may be irrelevant in this group.


Cupcakes and high-fives,

Anna Makarudze

Django Girls Fundraising Coordinator

-- 
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/c3cd0983-4c0e-492b-9183-2eb2c33b7760%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Dynamic creation of models

2018-02-06 Thread Jani Tiainen

Hi,

Since you're uploading more like documents than similary structured 
data, why not to use more proper tool, like document database (ArangoDB 
would get my vote) instead of trying to do what Django is not designed 
for and doesn't support well with concepts like "dynamic models".


We do similar thing with certain uploadable reports and it works pretty 
fine.


On 6.2.2018 13.35, Marc wrote:


Hello

Currently working on a project to allow researchers to upload data 
files into a repository. The system will only handle the import, 
validation and transformation of the data, so that it meets the 
required standards. When a file is upload the for the first time the 
user has to be able to define the structure of the destination based 
on the csv/xls. This includes key field, data types, foreign keys etc. 
There is no requirement for the data to be displayed or edited once in 
the repository by this system, currently. We are currently planning on 
using PostgreSQL as the database.


Our organisation already has another system, with a similar 
requirement, that is partially written by an external contractor in 
Ruby on Rails. The dynamic creation of the tables is no problem but it 
is the dynamic creation of the models and controllers that is proving 
difficult and is the reason why this other project is not finished.


Reading through the forums it looks like Django may offer a better 
solution through meta-programming. 
https://code.djangoproject.com/wiki/DynamicModels This does look like 
quite an old article though.


The other solution would be to have one table that holds all the 
records for all the imported files and have a JSONB (in PostgreSQL) to 
hold the columns that differ between files. This means that we would 
not be able to represent the relationships between files though. 
Ideally the organisation would like the data in a relational form to 
make subsequent analysis with other tools easier.


Above all it is important that the system is robust and maintainable. 
Any solution will of course be tested by creating a proof of concept 
first.


Is it still possible to dynamically create the models in the latest 
versions of Django (1.11 and 2.02)?


Thank you

Marc

--
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/d707e803-3dbf-43e6-95a8-13869043c280%40googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
Jani Tiainen

--
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/6fe07cc0-0b83-8834-adcd-382a45468e01%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Dynamic creation of models

2018-02-06 Thread Marc
Thank you Jani, for taking the time to respond. We are currently at the 
design stage so are considering all options. We have used document 
databases (MongoDB) for other projects and in those cases it turned out to 
not be good fit. I agree that at first glance a document database does 
feels like a good fit, but I want to explore all options. The organisation 
is asking for quite ambitious requirements (moon on a stick), they are 
going to have to make compromises I am sure. A good compromise does seem to 
be the JOSN column data type in both PostgreSQL and MySQL, I believe that 
both Ruby on Rails and Django have support

On Tuesday, February 6, 2018 at 12:14:59 PM UTC, Jani Tiainen wrote:
>
> Hi,
> Since you're uploading more like documents than similary structured data, 
> why not to use more proper tool, like document database (ArangoDB would get 
> my vote) instead of trying to do what Django is not designed for and 
> doesn't support well with concepts like "dynamic models".
>
> We do similar thing with certain uploadable reports and it works pretty 
> fine.
>
> On 6.2.2018 13.35, Marc wrote:
>
> Hello
>
>  
>
> Currently working on a project to allow researchers to upload data files 
> into a repository. The system will only handle the import, validation and 
> transformation of the data, so that it meets the required standards. When a 
> file is upload the for the first time the user has to be able to define the 
> structure of the destination based on the csv/xls. This includes key field, 
> data types, foreign keys etc. There is no requirement for the data to be 
> displayed or edited once in the repository by this system, currently. We 
> are currently planning on using PostgreSQL as the database.
>
>  
>
> Our organisation already has another system, with a similar requirement, 
> that is partially written by an external contractor in Ruby on Rails. The 
> dynamic creation of the tables is no problem but it is the dynamic creation 
> of the models and controllers that is proving difficult and is the reason 
> why this other project is not finished. 
>
>  
>
> Reading through the forums it looks like Django may offer a better 
> solution through meta-programming. 
> https://code.djangoproject.com/wiki/DynamicModels This does look like 
> quite an old article though. 
>
>  
>
> The other solution would be to have one table that holds all the records 
> for all the imported files and have a JSONB (in PostgreSQL) to hold the 
> columns that differ between files. This means that we would not be able to 
> represent the relationships between files though. Ideally the organisation 
> would like the data in a relational form to make subsequent analysis with 
> other tools easier.
>
>  
>
> Above all it is important that the system is robust and maintainable. Any 
> solution will of course be tested by creating a proof of concept first.
>
>  
>
> Is it still possible to dynamically create the models in the latest 
> versions of Django (1.11 and 2.02)? 
>
>  
>
> Thank you
>
> Marc
> -- 
> 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/d707e803-3dbf-43e6-95a8-13869043c280%40googlegroups.com
>  
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
> -- 
> Jani Tiainen
>
>

-- 
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/fb92bdc8-6c2b-4fa0-b8a7-af1bede7aa0e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Dynamic creation of models

2018-02-06 Thread Marc
This is an interesting article against document databases, I am sure though 
that there are equally valid arguments for
http://www.sarahmei.com/blog/2013/11/11/why-you-should-never-use-mongodb/

On Tuesday, February 6, 2018 at 1:14:41 PM UTC, Marc wrote:
>
> Thank you Jani, for taking the time to respond. We are currently at the 
> design stage so are considering all options. We have used document 
> databases (MongoDB) for other projects and in those cases it turned out to 
> not be good fit. I agree that at first glance a document database does 
> feels like a good fit, but I want to explore all options. The organisation 
> is asking for quite ambitious requirements (moon on a stick), they are 
> going to have to make compromises I am sure. A good compromise does seem to 
> be the JOSN column data type in both PostgreSQL and MySQL, I believe that 
> both Ruby on Rails and Django have support
>
> On Tuesday, February 6, 2018 at 12:14:59 PM UTC, Jani Tiainen wrote:
>>
>> Hi,
>> Since you're uploading more like documents than similary structured data, 
>> why not to use more proper tool, like document database (ArangoDB would get 
>> my vote) instead of trying to do what Django is not designed for and 
>> doesn't support well with concepts like "dynamic models".
>>
>> We do similar thing with certain uploadable reports and it works pretty 
>> fine.
>>
>> On 6.2.2018 13.35, Marc wrote:
>>
>> Hello
>>
>>  
>>
>> Currently working on a project to allow researchers to upload data files 
>> into a repository. The system will only handle the import, validation and 
>> transformation of the data, so that it meets the required standards. When a 
>> file is upload the for the first time the user has to be able to define the 
>> structure of the destination based on the csv/xls. This includes key field, 
>> data types, foreign keys etc. There is no requirement for the data to be 
>> displayed or edited once in the repository by this system, currently. We 
>> are currently planning on using PostgreSQL as the database.
>>
>>  
>>
>> Our organisation already has another system, with a similar requirement, 
>> that is partially written by an external contractor in Ruby on Rails. The 
>> dynamic creation of the tables is no problem but it is the dynamic creation 
>> of the models and controllers that is proving difficult and is the reason 
>> why this other project is not finished. 
>>
>>  
>>
>> Reading through the forums it looks like Django may offer a better 
>> solution through meta-programming. 
>> https://code.djangoproject.com/wiki/DynamicModels This does look like 
>> quite an old article though. 
>>
>>  
>>
>> The other solution would be to have one table that holds all the records 
>> for all the imported files and have a JSONB (in PostgreSQL) to hold the 
>> columns that differ between files. This means that we would not be able to 
>> represent the relationships between files though. Ideally the organisation 
>> would like the data in a relational form to make subsequent analysis with 
>> other tools easier.
>>
>>  
>>
>> Above all it is important that the system is robust and maintainable. Any 
>> solution will of course be tested by creating a proof of concept first.
>>
>>  
>>
>> Is it still possible to dynamically create the models in the latest 
>> versions of Django (1.11 and 2.02)? 
>>
>>  
>>
>> Thank you
>>
>> Marc
>> -- 
>> 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/d707e803-3dbf-43e6-95a8-13869043c280%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> -- 
>> Jani Tiainen
>>
>>

-- 
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/117a9163-ad2e-4d18-b599-63f766bb5587%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Dynamic creation of models

2018-02-06 Thread Jani Tiainen

Hi,

That's why I suggested ArangoDB since it's really transactional like 
normal relational databases. It's harder to get it out of sync than for 
example MongoDB.


Also surprisingly ArangoDB query language is really close to SQL.

You should give it a spin. That was the reason we picked ArangoDB for 
out projects.


On 6.2.2018 15.16, Marc wrote:
This is an interesting article against document databases, I am sure 
though that there are equally valid arguments for

http://www.sarahmei.com/blog/2013/11/11/why-you-should-never-use-mongodb/

On Tuesday, February 6, 2018 at 1:14:41 PM UTC, Marc wrote:

Thank you Jani, for taking the time to respond. We are currently
at the design stage so are considering all options. We have used
document databases (MongoDB) for other projects and in those cases
it turned out to not be good fit. I agree that at first glance a
document database does feels like a good fit, but I want to
explore all options. The organisation is asking for quite
ambitious requirements (moon on a stick), they are going to have
to make compromises I am sure. A good compromise does seem to be
the JOSN column data type in both PostgreSQL and MySQL, I believe
that both Ruby on Rails and Django have support

On Tuesday, February 6, 2018 at 12:14:59 PM UTC, Jani Tiainen wrote:

Hi,

Since you're uploading more like documents than similary
structured data, why not to use more proper tool, like
document database (ArangoDB would get my vote) instead of
trying to do what Django is not designed for and doesn't
support well with concepts like "dynamic models".

We do similar thing with certain uploadable reports and it
works pretty fine.

On 6.2.2018 13.35, Marc wrote:


Hello

Currently working on a project to allow researchers to upload
data files into a repository. The system will only handle the
import, validation and transformation of the data, so that it
meets the required standards. When a file is upload the for
the first time the user has to be able to define the
structure of the destination based on the csv/xls. This
includes key field, data types, foreign keys etc. There is no
requirement for the data to be displayed or edited once in
the repository by this system, currently. We are currently
planning on using PostgreSQL as the database.

Our organisation already has another system, with a similar
requirement, that is partially written by an external
contractor in Ruby on Rails. The dynamic creation of the
tables is no problem but it is the dynamic creation of the
models and controllers that is proving difficult and is the
reason why this other project is not finished.

Reading through the forums it looks like Django may offer a
better solution through meta-programming.
https://code.djangoproject.com/wiki/DynamicModels
 This does
look like quite an old article though.

The other solution would be to have one table that holds all
the records for all the imported files and have a JSONB (in
PostgreSQL) to hold the columns that differ between files.
This means that we would not be able to represent the
relationships between files though. Ideally the organisation
would like the data in a relational form to make subsequent
analysis with other tools easier.

Above all it is important that the system is robust and
maintainable. Any solution will of course be tested by
creating a proof of concept first.

Is it still possible to dynamically create the models in the
latest versions of Django (1.11 and 2.02)?

Thank you

Marc

-- 
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/d707e803-3dbf-43e6-95a8-13869043c280%40googlegroups.com

.
For more options, visit https://groups.google.com/d/optout
.


-- 
Jani Tiainen


--
You received this message because you are subscribed to the Google 
Groups "Django users" group.
To unsubscribe from this g

Preventing apps installing duplicate models

2018-02-06 Thread Murat Sert
Hi,

I'm working on a project upgrade from Django 1.8 to 1.11. They've used a 
custom registration app which is inheriting from Django Registration Redux 
package. 
Both packages are listed on installed_apps list. All works fine however 
when I try to run tests, where it creates test tables back to back, it 
errors at the following lines:
```

Creating table profile_preferences
Creating table registration_registrationprofile
Creating table registration_registrationprofile
django.db.utils.ProgrammingError: relation 
"registration_registrationprofile" already exists
```

This is because both Apps are listed within the installed_apps list. Is 
there a way around this? 

Removing the django-registration-redux from installed_apps causes 
```RuntimeError: Model class registration.models.RegistrationProfile 
doesn't declare an explicit app_label and isn't in an application in 
INSTALLED_APPS.``` error.


Regards

Murat

-- 
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/f9774a9a-cc7e-444d-b7d3-432192d3b5df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: I hope to increase OneToOne mode GenericForeignKey

2018-02-06 Thread Matemática A3K
On Mon, Feb 5, 2018 at 6:57 PM, Ma Mars  wrote:

> I hope to increase OneToOne mode GenericForeignKey,
> For example, a passport (one user has only one passport, but there are
> many user roles, such as staff, drivers, customers, but they are one to one)
>

It's hard to understand what you are trying to do, please try to be more
verbose in order to get 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/41d3d6c1-16ec-4f61-badb-4522c7caad4a%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/CA%2BFDnhL8Owc_HGcjuwXwZfmzOvvwnse540af3tsSnKe5J1DJCg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Dynamic creation of models

2018-02-06 Thread Matemática A3K
On Tue, Feb 6, 2018 at 8:35 AM, Marc  wrote:

> Hello
>
>
>
> Currently working on a project to allow researchers to upload data files
> into a repository. The system will only handle the import, validation and
> transformation of the data, so that it meets the required standards. When a
> file is upload the for the first time the user has to be able to define the
> structure of the destination based on the csv/xls. This includes key field,
> data types, foreign keys etc. There is no requirement for the data to be
> displayed or edited once in the repository by this system, currently. We
> are currently planning on using PostgreSQL as the database.
>
>
>
> Our organisation already has another system, with a similar requirement,
> that is partially written by an external contractor in Ruby on Rails. The
> dynamic creation of the tables is no problem but it is the dynamic creation
> of the models and controllers that is proving difficult and is the reason
> why this other project is not finished.
>
>
>
> Reading through the forums it looks like Django may offer a better
> solution through meta-programming. https://code.djangoproject.
> com/wiki/DynamicModels This does look like quite an old article though.
>
>
>
> The other solution would be to have one table that holds all the records
> for all the imported files and have a JSONB (in PostgreSQL) to hold the
> columns that differ between files. This means that we would not be able to
> represent the relationships between files though. Ideally the organisation
> would like the data in a relational form to make subsequent analysis with
> other tools easier.
>
>
>
> Above all it is important that the system is robust and maintainable. Any
> solution will of course be tested by creating a proof of concept first.
>
>
>
> Is it still possible to dynamically create the models in the latest
> versions of Django (1.11 and 2.02)?
>
>
>
> Thank you
>
> Marc
>

This can help you with the modelling:
https://github.com/sromero84/django-eav

Still, seems that the structure and its content will be tied to Django -
you will have to access it through your Django app. If you want to have it
in a "normalized" form in the database, what you need to write in Django is
the frontend to a python import tool and then for displaying the data. In
this case, you "decouple Django from the data", your app contains history
about the imports and how to retrieve the info. In the first case, you
access the data through your Django models which gives you the structure of
the data.

HTH


> --
> 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/d707e803-3dbf-43e6-95a8-13869043c280%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/CA%2BFDnhLxm24GTN-mQUbi6gDrzJj4iSFRFzc%3DNOMA9sFP%3D8CeNQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Please support Django Girls Fundraising Campaign (sorry for irrelevant topic in this group)

2018-02-06 Thread Matemática A3K
On Tue, Feb 6, 2018 at 8:46 AM, Anna Makarudze  wrote:

> Hello all,
>
>
> My name is Anna Makarudze. I am the Django Girls Foundation Fundraising
> Coordinator.
>
>
> I would like to take this opportunity to inform you about the crowdfunding
> project we launched this week to raise funds which we need to continue our
> work in bringing in more women to coding. Since Django Girls was started
> three years ago, over 12,000 women have attended our workshops and learnt
> to code using Python and Django. We would like to continue growing the
> number in 2018. We are running our fundraising project through
> crowdfunding on Indiegogo Generosity, an online crowdfunding platform (
> https://www.generosity.com/community-fundraising/django-gir
> ls-fundraising-campaign/x/17493288). Our target is to raise USD 10,000 in
> four to six weeks through corporate sponsorships and crowdfunding. We are
> hoping you will support us and help us reach our goal.
>
> If your company is interested in corporate sponsorship, please contact me
> and I will share with you our Sponsors Deck for 2018 which contains
> information about our corporate sponsorship packages. We hope you can share
> the within your organisation as well as spread the word about the campaign
> to your friends, family and colleagues.
>
>
> Please feel free to ask me any questions you may have.
>
> Thank you.
>
>
> P.S Sorry for the post which may be irrelevant in this group.
>

Not at all, best of luck with your campaign! :)


>
> Cupcakes and high-fives,
>
> Anna Makarudze
>
> Django Girls Fundraising Coordinator
>
> --
> 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/c3cd0983-4c0e-492b-9183-2eb2c33b7760%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/CA%2BFDnh%2BU03gJzPGKtvE_NenR2RY9GsJXwQkdieV-Zctzm2eY_Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Please support Django Girls Fundraising Campaign (sorry for irrelevant topic in this group)

2018-02-06 Thread Gerardo Palazuelos Guerrero
the django girls project was my introduction to django, and it was a good
one.

thanks to all people and their time...
and good luck


--
Gerardo Palazuelos Guerrero


On Tue, Feb 6, 2018 at 4:46 AM, Anna Makarudze  wrote:

> Hello all,
>
>
> My name is Anna Makarudze. I am the Django Girls Foundation Fundraising
> Coordinator.
>
>
> I would like to take this opportunity to inform you about the crowdfunding
> project we launched this week to raise funds which we need to continue our
> work in bringing in more women to coding. Since Django Girls was started
> three years ago, over 12,000 women have attended our workshops and learnt
> to code using Python and Django. We would like to continue growing the
> number in 2018. We are running our fundraising project through
> crowdfunding on Indiegogo Generosity, an online crowdfunding platform (
> https://www.generosity.com/community-fundraising/django-gir
> ls-fundraising-campaign/x/17493288). Our target is to raise USD 10,000 in
> four to six weeks through corporate sponsorships and crowdfunding. We are
> hoping you will support us and help us reach our goal.
>
> If your company is interested in corporate sponsorship, please contact me
> and I will share with you our Sponsors Deck for 2018 which contains
> information about our corporate sponsorship packages. We hope you can share
> the within your organisation as well as spread the word about the campaign
> to your friends, family and colleagues.
>
>
> Please feel free to ask me any questions you may have.
>
> Thank you.
>
>
> P.S Sorry for the post which may be irrelevant in this group.
>
>
> Cupcakes and high-fives,
>
> Anna Makarudze
>
> Django Girls Fundraising Coordinator
>
> --
> 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/c3cd0983-4c0e-492b-9183-2eb2c33b7760%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/CAJ8iCyOfov04jCSAJKioD_Ha7Uqj49LZ%3DxvPaLhrd4w8V9G4nA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Preventing apps installing duplicate models

2018-02-06 Thread Matemática A3K
On Tue, Feb 6, 2018 at 1:23 PM, Murat Sert  wrote:

> Hi,
>
> I'm working on a project upgrade from Django 1.8 to 1.11. They've used a
> custom registration app which is inheriting from Django Registration Redux
> package.
> Both packages are listed on installed_apps list. All works fine however
> when I try to run tests, where it creates test tables back to back, it
> errors at the following lines:
> ```
> 
> Creating table profile_preferences
> Creating table registration_registrationprofile
> Creating table registration_registrationprofile
> django.db.utils.ProgrammingError: relation 
> "registration_registrationprofile"
> already exists
> ```
>
> This is because both Apps are listed within the installed_apps list. Is
> there a way around this?
>
> Removing the django-registration-redux from installed_apps causes
> ```RuntimeError: Model class registration.models.RegistrationProfile
> doesn't declare an explicit app_label and isn't in an application in
> INSTALLED_APPS.``` error.
>

If you provide an app_label in the Model's Meta (whatever installed app),
does it run?


>
>
> Regards
>
> Murat
>
> --
> 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/f9774a9a-cc7e-444d-b7d3-432192d3b5df%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/CA%2BFDnhKoQ9OvQEx2bCA8hzHQOb8rasmdtpSA%2Be5Zy7UWF3YFgg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Please support Django Girls Fundraising Campaign (sorry for irrelevant topic in this group)

2018-02-06 Thread Etienne Robillard



Le 2018-02-06 à 13:55, Gerardo Palazuelos Guerrero a écrit :
the django girls project was my introduction to django, and it was a 
good one.

I don't know man.
Basically I guess programming Django/Python is not gender specific, so 
it makes very little difference to me.


thanks to all people and their time...
and good luck


Best regards,
Etienne





--
Gerardo Palazuelos Guerrero


On Tue, Feb 6, 2018 at 4:46 AM, Anna Makarudze > wrote:


Hello all,

My name is Anna Makarudze. I am the Django Girls Foundation
Fundraising Coordinator.

I would like to take this opportunity to inform you about the
crowdfunding project we launched this week to raise funds which we
need to continue our work in bringing in more women to coding.
Since Django Girls was started three years ago, over 12,000 women
have attended our workshops and learnt to code using Python and
Django. We would like to continue growing the number in 2018. We
are running our fundraising project through crowdfunding on
Indiegogo Generosity, an online crowdfunding platform

(https://www.generosity.com/community-fundraising/django-girls-fundraising-campaign/x/17493288

).
Our target is to raise USD 10,000 in four to six weeks through
corporate sponsorships and crowdfunding. We are hoping you will
support us and help us reach our goal.

If your company is interested in corporate sponsorship, please
contact me and I will share with you our Sponsors Deck for 2018
which contains information about our corporate sponsorship
packages. We hope you can share the within your organisation as
well as spread the word about the campaign to your friends, family
and colleagues.

Please feel free to ask me any questions you may have.

Thank you.

P.S Sorry for the post which may be irrelevant in this group.

Cupcakes and high-fives,

Anna Makarudze

Django Girls Fundraising Coordinator

-- 
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/c3cd0983-4c0e-492b-9183-2eb2c33b7760%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/CAJ8iCyOfov04jCSAJKioD_Ha7Uqj49LZ%3DxvPaLhrd4w8V9G4nA%40mail.gmail.com 
.

For more options, visit https://groups.google.com/d/optout.


--
Etienne Robillard
tkad...@yandex.com
https://www.isotopesoftware.ca/

--
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/c49f915a-57db-2111-48e0-17337262259e%40yandex.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django-hotsauce: Current status and roadmap

2018-02-06 Thread Etienne Robillard

Hi,

Someone really need to explain how to properly test/benchmark Django 
with unittest integration. I'm looking to test/benchmark the django 
models API against Non-SQL databases like Schevo, ZODB, and Durus. i 
plan to isolate and verify the latency of basic SQL database querying 
with sqlite3 when using standard Django 1.11 models. i would also like 
to measure the speed of ZODB connections.


Is it possible to not use uWSGI while running Django benchmarks with 
unittest?


Best regards,
Etienne

Le 2018-02-04 à 04:19, Etienne Robillard a écrit :


Hi,

Is wrk (https://github.com/wg/wrk) any better than ab for making HTTP 
benchmarks of django applications?


how should i collect wrk input to make graphs in Python?

Etienne


Le 2018-02-01 à 04:27, Etienne Robillard a écrit :


Hi,

Actually, I want to benchmark the WSGI application/handler of Django 
2.0.1.


And, I want to compare the Gevent loop engine with python based 
poll/epoll .


Do i really need to setup django with uwsgi to make theses 
tests/benchmarks?



Etienne


Le 2018-01-31 à 19:02, Etienne Robillard a écrit :


Hi,

Any ideas of good python library for benchmarking standalone Django 
2.0 http server?


Thanks in advance,

Etienne


Le 2018-01-31 à 07:38, Etienne Robillard a écrit :


Hi Avraham,


Le 2018-01-31 à 06:35, Avraham Serour a écrit :

Why do you call it microframework?


Because it still depends mostly on the core Django API.

You should prove it is high performance, benchmark, measure, 
compare and show some cool graphs


All right. I'm planning to benchmark the following:

Django-hotsauce 0.8.2 with Cython extensions
Django-hotsauce 0.8.2 with CPython 3.7
Django-hotsauce 0.8.2 with ZODB database
Django-hotsauce 0.9.0 with PyPy 5.9
Django-hotsauce 0.9.0 with CPython 3.7
Django-hotsauce 0.9.0 with ZODB database
Django 1.11.7 with SQLite database
Django 1.11.7 with CPython 3.7
Django 1.11.7 with PyPy 5.9
Django 2.0.1 with SQLite database
Django 2.0.1 with CPython 3.7
Django 2.0.1 with PyPy 5.9



I already have a Django project, is it a drop in replacement?


Technically, it is a full-scale web microframework on top of 
Django. You still need to install Django to run Django-hotsauce.


My project uses python 3.6 while you only have experimental 
support for 3.5. I'm not going back, you should have already 
experimental support for 3.7 at least


I don't expect huge differences between python 3.5 and 3.7. I will 
try to update in order to make cool benchmarks. :)


Many thanks for your input!

Etienne



On 31 Jan 2018 12:35, "Etienne Robillard" > wrote:


Hi everyone,

This is a quick post to present the current state of
development in Django-hotsauce, a high-performance and
scalable WSGI microframework on top of Django and others.

Django-hotsauce has now reached the 0.9 milestone. New major
features now supported includes:

  * uWSGI support with Gevent loop engine
  * Full ZODB databases support through the Schevo DBMS
  * OAuth2 authentication and authorization support with
thread-local request storage based on Werkzeug
  * Experimental PyPy 5.9 and CPython 3.5 support
  * Backward compatibility with Django 1.4 and Django 1.11

What should be done next? How can Django-hotsauce attract a
larger audience?


Best regards,

Etienne



-- 
Etienne Robillard

tkad...@yandex.com 
https://www.isotopesoftware.ca/ 

-- 
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/680aff87-b96d-7a55-4515-a1762e02f5de%40yandex.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/djan

Re: Please support Django Girls Fundraising Campaign (sorry for irrelevant topic in this group)

2018-02-06 Thread Matemática A3K
On Tue, Feb 6, 2018 at 4:12 PM, Etienne Robillard 
wrote:

>
>
> Le 2018-02-06 à 13:55, Gerardo Palazuelos Guerrero a écrit :
>
> the django girls project was my introduction to django, and it was a good
> one.
>
> I don't know man.
> Basically I guess programming Django/Python is not gender specific, so it
> makes very little difference to me.
>

It is not, so it is not country specific yet there are Python/Django
communities in almost every country... but seems like a long way to go
until humanity realizes the stupidity of borders and give up segregation in
whatever condition they put in their minds :)

Artificial divisions are one of the causes of the worst problems :)

I know "bad" women in tech, "good" women in tech, "bad" women outside tech,
"good" women outside tech, "good" and "bad" men in and out tech. It's not
about that.

Any group that promotes to gain an ability or do something that otherwise
seems subjectively unachievable by the mental framework imposed to that
people with whatever condition (nor good or bad, gender, nationality,
sexual orientation, race, money, whatever...) is a great thing, because it
leverage an artificial division that made people felt like they were dumb,
"less" or whatever... feeling unhappy and living way below their potential.

It's about helping to overcome that mental barrier :)

And if you do that while contributing to the core of the community and
including more people, its AMAZING! A hell of a work!

More people happy in every place! Yay!

So, GO DJANGO GIRLS!!!


>
> thanks to all people and their time...
> and good luck
>
>
> Best regards,
> Etienne
>
>
>
>
>
> --
> Gerardo Palazuelos Guerrero
>
>
> On Tue, Feb 6, 2018 at 4:46 AM, Anna Makarudze 
> wrote:
>
>> Hello all,
>>
>> My name is Anna Makarudze. I am the Django Girls Foundation Fundraising
>> Coordinator.
>>
>> I would like to take this opportunity to inform you about the
>> crowdfunding project we launched this week to raise funds which we need to
>> continue our work in bringing in more women to coding. Since Django
>> Girls was started three years ago, over 12,000 women have attended our
>> workshops and learnt to code using Python and Django. We would like to
>> continue growing the number in 2018. We are running our fundraising
>> project through crowdfunding on Indiegogo Generosity, an online
>> crowdfunding platform (https://www.generosity.com/co
>> mmunity-fundraising/django-girls-fundraising-campaign/x/17493288). Our
>> target is to raise USD 10,000 in four to six weeks through corporate
>> sponsorships and crowdfunding. We are hoping you will support us and help
>> us reach our goal.
>>
>> If your company is interested in corporate sponsorship, please contact me
>> and I will share with you our Sponsors Deck for 2018 which contains
>> information about our corporate sponsorship packages. We hope you can share
>> the within your organisation as well as spread the word about the campaign
>> to your friends, family and colleagues.
>>
>> Please feel free to ask me any questions you may have.
>>
>> Thank you.
>>
>> P.S Sorry for the post which may be irrelevant in this group.
>>
>> Cupcakes and high-fives,
>>
>> Anna Makarudze
>>
>> Django Girls Fundraising Coordinator
>> --
>> 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/ms
>> gid/django-users/c3cd0983-4c0e-492b-9183-2eb2c33b7760%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/CAJ8iCyOfov04jCSAJKioD_Ha7Uqj49LZ%
> 3DxvPaLhrd4w8V9G4nA%40mail.gmail.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> Etienne Robillardtkadm30@yandex.comhttps://www.isotopesoftware.ca/
>
> --
> 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,

Re: Please support Django Girls Fundraising Campaign (sorry for irrelevant topic in this group)

2018-02-06 Thread Etienne Robillard


Le 2018-02-06 à 15:04, Matemática A3K a écrit :





It is not, so it is not country specific yet there are Python/Django 
communities in almost every country... but seems like a long way to go 
until humanity realizes the stupidity of borders and give up 
segregation in whatever condition they put in their minds :)


What do you mean with "segregation" ?

I'm not really sure what this quote means.



I know "bad" women in tech, "good" women in tech, "bad" women outside 
tech, "good" women outside tech, "good" and "bad" men in and out tech. 
It's not about that.


You can qualify a person with good or bad as you like, but a subjective 
comment has no true scientific value...
Any group that promotes to gain an ability or do something that 
otherwise seems subjectively unachievable by the mental framework 
imposed to that people with whatever condition (nor good or bad, 
gender, nationality, sexual orientation, race, money, whatever...) is 
a great thing, because it leverage an artificial division that made 
people felt like they were dumb, "less" or whatever... feeling unhappy 
and living way below their potential.



So, is django a mental framework? :-)


It's about helping to overcome that mental barrier :)
The only mental barrier existing is my own capacity to think/code out of 
the box...


And if you do that while contributing to the core of the community and 
including more people, its AMAZING! A hell of a work!


More people happy in every place! Yay!

So, GO DJANGO GIRLS!!!



Best regards,
Etienne








--
Gerardo Palazuelos Guerrero


On Tue, Feb 6, 2018 at 4:46 AM, Anna Makarudze > wrote:


Hello all,

My name is Anna Makarudze. I am the Django Girls Foundation
Fundraising Coordinator.

I would like to take this opportunity to inform you about the
crowdfunding project we launched this week to raise funds which
we need to continue our work in bringing in more women to coding.
Since Django Girls was started three years ago, over 12,000 women
have attended our workshops and learnt to code using Python and
Django. We would like to continue growing the number in 2018. We
are running our fundraising project through crowdfunding on
Indiegogo Generosity, an online crowdfunding platform

(https://www.generosity.com/community-fundraising/django-girls-fundraising-campaign/x/17493288

).
Our target is to raise USD 10,000 in four to six weeks through
corporate sponsorships and crowdfunding. We are hoping you will
support us and help us reach our goal.

If your company is interested in corporate sponsorship, please
contact me and I will share with you our Sponsors Deck for 2018
which contains information about our corporate sponsorship
packages. We hope you can share the within your organisation as
well as spread the word about the campaign to your friends,
family and colleagues.

Please feel free to ask me any questions you may have.

Thank you.

P.S Sorry for the post which may be irrelevant in this group.

Cupcakes and high-fives,

Anna Makarudze

Django Girls Fundraising Coordinator

-- 
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/c3cd0983-4c0e-492b-9183-2eb2c33b7760%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/CAJ8iCyOfov04jCSAJKioD_Ha7Uqj49LZ%3DxvPaLhrd4w8V9G4nA%40mail.gmail.com 


Django Postgresql Heroku : Operational Error - 'FATAL too many connections for role “usename”'

2018-02-06 Thread Tomiwa Ademidun


0down votefavorite 


I am running a web application using Django and Django Rest Framework on 
Heroku with a postgresql and redis datastore. I am on the free postgresql 
tier which is limited to 20 connections.

This hasn't been an issue in the past, but recently I started using django 
channels 2. 0 and the daphne server 
 (switched my Procfile from gunicorn to 
daphne like this tutorial 
)
 
and now I have been running into all sort of weird problems.

The most critical is that connections to the database are being left open 
so as the app runs, the number of connections keep increasing until it 
reaches 20 and gives me the following error message: Operational Error - 
'FATAL too many connections for role "usename"'

[image: Sentry Error Description] 

[image: postgresql connection utilization] 
 


Then I have to manually go to shell and type heroku pg:killall each time, 
this is obviously not a feasible solution and this is production so my 
users cant get access to site and get 500 errors. Would really appreciate 
any help.

I have tried:

Adding this to my different views in different places

from django.db import connections conections.close_all()

for con in connections: con.close()

I also tried doing SELECT * from pg_activity and saw a bunch of stuff but 
have no idea what to make of it:




-- 
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/50195a32-6dcb-4ad5-a778-c83b5f366718%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


django-channels-2.0 Postgresql Heroku : Operational Error - 'FATAL too many connections for role “usename”'

2018-02-06 Thread Tomiwa Ademidun


I am running a web application using Django and Django Rest Framework on 
Heroku with a postgresql and redis datastore. I am on the free postgresql 
tier which is limited to 20 connections.


This hasn't been an issue in the past, but recently I started using django 
channels 2. 0 and the daphne server 
 (switched my Procfile from gunicorn to 
daphne like this tutorial 
)
 
and now I have been running into all sort of weird problems.


The most critical is that connections to the database are being left open 
so as the app runs, the number of connections keep increasing until it 
reaches 20 and gives me the following error message: Operational Error - 
'FATAL too many connections for role "usename"'

[image: Sentry Error Description] 

[image: postgresql connection utilization] 
 Then I have to manually go to shell 
and type heroku pg:killall each time, this is obviously not a feasible 
solution and this is production so my users cant get access to site and get 
500 errors. Would really appreciate any help.

I have tried:

Adding this to my different views in different places

from django.db import connections conections.close_all()

for con in connections: con.close()

I also tried doing SELECT * from pg_activity and saw a bunch of stuff but 
have no idea what to make of it:

[image: Heroku Dataclip pg_activity] 
Click here to Reply

-- 
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/05a06038-2657-4bf7-bb61-0475cc309321%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Testing Channels database data missing in Consumer

2018-02-06 Thread Daniel Gilge
Hi,

this question is related to Channels 2.0, Django 2.0, pytest 3.4, 
pytest-django 3.1 and pytest-asyncio 0.8.

I created a pytest:

@pytest.fixture
def db_with_obj(db):
factories.MyModelFactory()

@pytest.mark.asyncio
async def test_something(db_with_obj):
print(models.MyModelFactory.objects.all())
obj = models.MyModelFactory.objects.first()
communicator = WebsocketCommunicator(MyConsumer, 'ws/')
connected, subprotocol = await communicator.connect()
assert connected
await communicator.send_to(text_data=json.dumps({
'id': obj.pk,
'content': 'my content',
}))
response = await communicator.receive_from()
assert response == 'my content'
await communicator.disconnect()

print gives me ]>

Here my Consumer code:

class MyConsumer(WebsocketConsumer):
def receive(self, text_data=None, bytes_data=None):
print(models.MyModel.objects.all())
# ...

print gives me 

I don't know what I'm doing wrong. I didn't use both, pytest and Python 
async code, before. Therefore I don't know where to look for the solution, 
though I think it's easy to solve. Any hint appreciated.

Thanks :)

-- 
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/7e5f63f4-789c-413e-a8d2-fcf8ea62a2cb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: django-channels-2.0 Postgresql Heroku : Operational Error - 'FATAL too many connections for role “usename”'

2018-02-06 Thread Andrew Godwin
This is an open issue in Channels 2, see here:
https://github.com/django/channels/issues/871

Andrew

On Tue, Feb 6, 2018 at 5:37 AM, Tomiwa Ademidun 
wrote:

> I am running a web application using Django and Django Rest Framework on
> Heroku with a postgresql and redis datastore. I am on the free postgresql
> tier which is limited to 20 connections.
>
>
> This hasn't been an issue in the past, but recently I started using django
> channels 2. 0 and the daphne server
>  (switched my Procfile from gunicorn
> to daphne like this tutorial
> )
> and now I have been running into all sort of weird problems.
>
>
> The most critical is that connections to the database are being left open
> so as the app runs, the number of connections keep increasing until it
> reaches 20 and gives me the following error message: Operational Error -
> 'FATAL too many connections for role "usename"'
>
> [image: Sentry Error Description] 
>
> [image: postgresql connection utilization]
>  Then I have to manually go to shell
> and type heroku pg:killall each time, this is obviously not a feasible
> solution and this is production so my users cant get access to site and get
> 500 errors. Would really appreciate any help.
>
> I have tried:
>
> Adding this to my different views in different places
>
> from django.db import connections conections.close_all()
>
> for con in connections: con.close()
>
> I also tried doing SELECT * from pg_activity and saw a bunch of stuff but
> have no idea what to make of it:
>
> [image: Heroku Dataclip pg_activity] 
> Click here to Reply
>
> --
> 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/05a06038-2657-4bf7-bb61-0475cc309321%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/CAFwN1urUyKug7TfXAxTbhS_dnPX8qeZomYYp%3Dx%2BLQL%2BsZBhGfg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Testing Channels database data missing in Consumer

2018-02-06 Thread Andrew Godwin
I'm not quite sure either. Does the test setup work if you are not in async
mode?

Andrew

On Tue, Feb 6, 2018 at 9:45 AM, Daniel Gilge  wrote:

> Hi,
>
> this question is related to Channels 2.0, Django 2.0, pytest 3.4,
> pytest-django 3.1 and pytest-asyncio 0.8.
>
> I created a pytest:
>
> @pytest.fixture
> def db_with_obj(db):
> factories.MyModelFactory()
>
> @pytest.mark.asyncio
> async def test_something(db_with_obj):
> print(models.MyModelFactory.objects.all())
> obj = models.MyModelFactory.objects.first()
> communicator = WebsocketCommunicator(MyConsumer, 'ws/')
> connected, subprotocol = await communicator.connect()
> assert connected
> await communicator.send_to(text_data=json.dumps({
> 'id': obj.pk,
> 'content': 'my content',
> }))
> response = await communicator.receive_from()
> assert response == 'my content'
> await communicator.disconnect()
>
> print gives me ]>
>
> Here my Consumer code:
>
> class MyConsumer(WebsocketConsumer):
> def receive(self, text_data=None, bytes_data=None):
> print(models.MyModel.objects.all())
> # ...
>
> print gives me 
>
> I don't know what I'm doing wrong. I didn't use both, pytest and Python
> async code, before. Therefore I don't know where to look for the solution,
> though I think it's easy to solve. Any hint appreciated.
>
> Thanks :)
>
> --
> 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/7e5f63f4-789c-413e-a8d2-fcf8ea62a2cb%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/CAFwN1uovKqRZJzWjd7CwWxQPkq1vCEMRTV-F1kFGtE8YDyecHw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django Postgresql Heroku : Operational Error - 'FATAL too many connections for role “usename”'

2018-02-06 Thread Andrew Godwin
This is a known issue: https://github.com/django/channels/issues/871

Andrew

On Tue, Feb 6, 2018 at 5:30 AM, Tomiwa Ademidun 
wrote:

>
> 0down votefavorite
> 
>
> I am running a web application using Django and Django Rest Framework on
> Heroku with a postgresql and redis datastore. I am on the free postgresql
> tier which is limited to 20 connections.
>
> This hasn't been an issue in the past, but recently I started using django
> channels 2. 0 and the daphne server
>  (switched my Procfile from gunicorn
> to daphne like this tutorial
> )
> and now I have been running into all sort of weird problems.
>
> The most critical is that connections to the database are being left open
> so as the app runs, the number of connections keep increasing until it
> reaches 20 and gives me the following error message: Operational Error -
> 'FATAL too many connections for role "usename"'
>
> [image: Sentry Error Description] 
>
> [image: postgresql connection utilization]
> 
>
>
> Then I have to manually go to shell and type heroku pg:killall each time,
> this is obviously not a feasible solution and this is production so my
> users cant get access to site and get 500 errors. Would really appreciate
> any help.
>
> I have tried:
>
> Adding this to my different views in different places
>
> from django.db import connections conections.close_all()
>
> for con in connections: con.close()
>
> I also tried doing SELECT * from pg_activity and saw a bunch of stuff but
> have no idea what to make of it:
>
> 
>
>
> --
> 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/50195a32-6dcb-4ad5-a778-c83b5f366718%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/CAFwN1ur18dg7PNh1XRG7b9gbThr%2B953o%2B%3DY4yJbSP8FGd%3D5m-w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Optimal query for related names in onetomany or manytomany using Django Queryset

2018-02-06 Thread Web Architect
Hi Furbee,

Thanks for the suggestion. Would look into it. 

Thanks. 

On Sunday, February 4, 2018 at 10:32:20 AM UTC+5:30, Furbee wrote:
>
> You can set up an index on multiple field, as well, so if you’re searching 
> for As without a reference from B or C, using the index_together operative 
> in the class Meta for that model. I’m not completely sure, but I think this 
> may speed up you query time.
>
> Thanks,
>
> Furbee
>
> On Saturday, February 3, 2018, Vijay Khemlani  > wrote:
>
>> Well, you should've said that in the first post.
>>
>> First I would try with a saner DB (Postgres)
>>
>> Also I don't think 300 ms is particularly bad, but in that case start 
>> looking into caching alternatives (e.g. memcached) or a search index (e.g. 
>> ElasticSearch) 
>>
>> On Sat, Feb 3, 2018 at 3:14 AM, Web Architect > > wrote:
>>
>>> Hi Furbee,
>>>
>>> Thanks for your response. 
>>>
>>> With my experience I have always noticed that a query within query kills 
>>> the mysql and Mysqld CPU usage hits the ceiling. I would still check your 
>>> alternate. 
>>>
>>> I have mentioned the size of A and B in response to Vijay's reply. 
>>>
>>> On Saturday, February 3, 2018 at 1:06:48 AM UTC+5:30, Furbee wrote:

 There are a couple options you could try to see which is the best fit 
 for your data. With DEBUG=True in settings.py you can check the actual 
 queries and process time. It depends on the sizes of A and B. Another 
 query 
 you can run is:

 A.objects.exclude(id__in=B.objects.all().values_list('a_id', flat=True))

 When I tried, it seemed to be about the same speed with my test data as 
 the one you had A.objects.filter(bs__isnull=True).

 To see what queries are generated and the query time with DEBUG=True:
 Open your Django Python Shell
 >>> A.objects.exclude(id__in=B.objects.all().values_list('a_id', 
 flat=True))
 >>> A.objects.filter(bs__isnull=True)
 >>> from django.db import connection
 >>> for q in connection.queries:
 >>> print("{0}: {1}".format(q['sql'], q['time']))

 This will show you both queries generated and how long it took to get a 
 response from your DB.

 You can also write raw SQL, if you can make one more efficiently.

 Furbee

 On Fri, Feb 2, 2018 at 10:56 AM, Vijay Khemlani  
 wrote:

> "with large of records in A and B, the above takes lot of time"
>
> How long? At first glance it doesn't look like a complex query or 
> something particularly inefficient for a DB.
>
> On Fri, Feb 2, 2018 at 11:31 AM, Andy  wrote:
>
>> not that i know of
>>
>>
>> Am Freitag, 2. Februar 2018 15:28:26 UTC+1 schrieb Web Architect:
>>>
>>> Hi Andy,
>>>
>>> Thanks for your response. I was pondering on option a before posting 
>>> this query thinking there could be better ways in django/SQL to handle 
>>> this. But now I would probably go with a.
>>>
>>> Thanks.
>>>
>>> On Friday, February 2, 2018 at 7:50:53 PM UTC+5:30, Andy wrote:

 a) Maybe its an option to put the foreign key to the other model? 
 This way you dont need to make a join to find out if there is a 
 relation.

 b) Save the existing ralation status to model A

 c) cache the A.objects.filter(bs__isnull=False) query

 But apart from that i fear you cannot do much more, since this is 
 just a DB and not a Django ORM question.


 Am Freitag, 2. Februar 2018 14:47:45 UTC+1 schrieb Web Architect:
>
> Hi,
>
> I am trying to optimise Django queries on my ecommerce website. 
> One of the fundamental query is where I have no clue how to make 
> efficient. 
> It could be trivial and probably been known long time back. But I am 
> new to 
> Django and would appreciate any help. This is primarily for one to 
> many or 
> many to many relations.
>
> Following is an example scenario:
> (Please pardon my syntax as I want to put across the concept and 
> not the exact django code unless it's really needed):
>
> Model A:
>
> class A(models.Model):
> # Fields of model A
>
> Model B (which is related to A with foreign key):
>
> class B(models.Model):
> a = models.ForeignKey('A', related_name='bs')
>
> Now I would like to find out all As for which there is atleast one 
> b. The only way I know is as follows:
>
> A.objects.filter(bs__isnull=False)
>
> But the above isn't an optimal way as with large of records in A 
> and B, the above takes lot of time. It gets more inefficient if it's 
> a many 
> to many relationship.
>
> Could anyone please let me k

Why is exclude() different than difference()?

2018-02-06 Thread viper12xn
Hi,

I have the following models: Abonnent -1:n- Sendungsadresse -1:1- Redresse
Model `Abonnent` has 99681 rows.

This query returns 829 rows, as expected:
`Abonnent.objects.filter(sendungsadresse__redresse__isnull=False, 
sendungsadresse__redresse__korrigiert_am__isnull=True).distinct()`

The second query returns 98852 rows, as expected:

`Abonnent.objects.all().difference(Abonnent.objects.filter(sendungsadresse__redresse__isnull=False,
 
sendungsadresse__redresse__korrigiert_am__isnull=True).distinct())`

But I want to be able to keep filtering and that does not work with 
difference().
So I created this query, that returns 98851 rows, when I was expecting 
99852 rows:
`Abonnent.objects.exclude(sendungsadresse__redresse__isnull=False, 
sendungsadresse__redresse__korrigiert_am__isnull=True)`

The missing Abonnent object in that query has two Sendungsadresse objects. 
The following statements are true for each corresponding Sendungsadresse 
object, but neither of them should be excluded, unless I am missing some 
peculiarity about exclude() (which I probably am, to be honest):
Object 1: redresse__isnull => True,  redresse__korrigiert_am__isnull => 
True
Object 2: redresse__isnull => False, redresse__korrigiert_am__isnull => 
False

-- 
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/1644468c-b3d3-4f53-8d99-49348a59a9e3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.