Simple Django package - helps you send emails and activation emails from views.

2018-04-05 Thread Mateusz Kurowski
Hello! 
I am just learning Python and Django, as an exercise for: django views, 
python packaging, travis, tox, sphinx i made this simple repository with 2 
classes that helps you send emails and activation-emails using django 
builtins. No extra dependencies Tested using hypothesis..

https://github.com/bukowa/django-emailviews 

Maybe someone will find it useful, i will use this for my projects for 
sure! i would love to hear some feedback!

Best of wishes to all of you!

-- 
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/01374995-caa0-48b8-b12b-e6af28dbf1f4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Mysql is gone away auth middleware channels 2

2018-04-05 Thread Matteo Lucchesi
i've write a auth middleware for django channels :

https://codeshare.io/aYnQmN

but seem that use a persistent connection and after some hour i have the 
erro "Mysql is gone away"

Where is the error?

-- 
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/3b959d96-760d-4358-8fe3-0115d56e6d0c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Mysql is gone away auth middleware channels 2

2018-04-05 Thread Matteo Lucchesi
https://codeshare.io/5wlXNK

Il giorno giovedì 5 aprile 2018 14:07:56 UTC+2, Matteo Lucchesi ha scritto:
>
> i've write a auth middleware for django channels :
>
> https://codeshare.io/aYnQmN
>
> but seem that use a persistent connection and after some hour i have the 
> erro "Mysql is gone away"
>
> Where is the error?
>

-- 
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/c8171fd2-a423-439e-b89c-813a747658a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Working google maps widget

2018-04-05 Thread Cictani
Yes something like this but as a django-package so I can use it as a form 
field in admin and in my custom forms. 

django-geoposition requires jquery2, django-google-maps-widget requires 
complete GIS package (which I don't need) and django-location-field did not 
worked for some reason I still haven't managed to find out. 

-- 
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/ec17e21b-834f-4988-8101-add1e05488af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


serializers

2018-04-05 Thread siva.gatti
how to add created_by_id to serializers in django rest rest frame work and 
created_by_id is stored in session when the user is logged in

-- 
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/da03a487-000b-42cb-9d72-da0969429889%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django rest framework foreign key display details from table 1 to table 2

2018-04-05 Thread siva.gatti
did u get the solution for this if found send that to me

-- 
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/7c1370fc-a665-4913-a7c2-77231ba258a0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django blocking on writing logs

2018-04-05 Thread Daniel Arndt
Hi all,

Although not explicitly mentioned anywhere, I've come to the conclusion 
Django blocks while writing logs with some handlers (it uses Python 
logging, 
https://docs.python.org/3/howto/logging-cookbook.html#dealing-with-handlers-that-block).

I can't find anything that explicitly states Django handles this already 
(in the code or documentation) and I believe it to be a problem in the 
platform I am working on. Justification for this belief is loose at best, 
but it's the best lead I have (specifically, the SysLogHandler seems like 
it might be blocking on sending to a UDP port, which seems crazy but 
apparently is possible)

I'm setting trying to see if I can solve this, but there seems to be very 
little details on this subject, and that alone worries me. So I have a 
couple questions for anyone willing to entertain me:


   1. Is it silly to be worried about this? My gut says yes, simply because 
   nobody else is. At the same time I see no real downside to logging 
   asynchronously (is that true?). There are potential upsides. It might not 
   solve the real problem (what is causing buffers to back up in the first 
   place? likely crazy I/O usage) but it might speed up handling of requests 
   during heavy I/O.
   2. Have you done anything similar to this? How did you approach it?
   3. The QueueHandler suggested in the Python cookbook doesn't seem to be 
   easy to stuff into Django. We have Django running behind Gunicorn, so my 
   thought was to have Gunicorn spin up a QueueListener process, and then have 
   Gunicorn pass the queue to each worker similar to this 
   cookbook: 
https://docs.python.org/3/howto/logging-cookbook.html#logging-to-a-single-file-from-multiple-processes
 
   -- I'm interested on any thoughts on this approach. Especially if there is 
   a better way.

Cheers,
Dan

-- 
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/ce269c78-bd6b-4e06-b9de-2da6ccc79cd8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django blocking on writing logs

2018-04-05 Thread David Bauer
No I gave up on Django, don't know what it does, and don't have the money
to take a class to learn more, so I just gave up for right now, when I see
some money I might be able to take a class

On Thu, Apr 5, 2018 at 9:51 AM, Daniel Arndt  wrote:

> Hi all,
>
> Although not explicitly mentioned anywhere, I've come to the conclusion
> Django blocks while writing logs with some handlers (it uses Python
> logging, https://docs.python.org/3/howto/logging-cookbook.
> html#dealing-with-handlers-that-block).
>
> I can't find anything that explicitly states Django handles this already
> (in the code or documentation) and I believe it to be a problem in the
> platform I am working on. Justification for this belief is loose at best,
> but it's the best lead I have (specifically, the SysLogHandler seems like
> it might be blocking on sending to a UDP port, which seems crazy but
> apparently is possible)
>
> I'm setting trying to see if I can solve this, but there seems to be very
> little details on this subject, and that alone worries me. So I have a
> couple questions for anyone willing to entertain me:
>
>
>1. Is it silly to be worried about this? My gut says yes, simply
>because nobody else is. At the same time I see no real downside to logging
>asynchronously (is that true?). There are potential upsides. It might not
>solve the real problem (what is causing buffers to back up in the first
>place? likely crazy I/O usage) but it might speed up handling of requests
>during heavy I/O.
>2. Have you done anything similar to this? How did you approach it?
>3. The QueueHandler suggested in the Python cookbook doesn't seem to
>be easy to stuff into Django. We have Django running behind Gunicorn, so my
>thought was to have Gunicorn spin up a QueueListener process, and then have
>Gunicorn pass the queue to each worker similar to this cookbook:
>https://docs.python.org/3/howto/logging-cookbook.
>html#logging-to-a-single-file-from-multiple-processes
>
> 
>-- I'm interested on any thoughts on this approach. Especially if there is
>a better way.
>
> Cheers,
> Dan
>
> --
> 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/ce269c78-bd6b-4e06-b9de-2da6ccc79cd8%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
David A. Bauer

-- 
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/CAJ%3DpNhEDYg_DWxorXDCtbCkLtMQfxatuh16apEFwfwf%3DREtW-g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Mysql is gone away auth middleware channels 2

2018-04-05 Thread Andrew Godwin
You must do all database access through a synchronous function wrapped in
database_sync_to_async - you can't just call it directly on an asyncio
thread:
http://channels.readthedocs.io/en/latest/topics/databases.html#database-sync-to-async

Andrew

On Thu, Apr 5, 2018 at 5:25 AM, Matteo Lucchesi  wrote:

> https://codeshare.io/5wlXNK
>
> Il giorno giovedì 5 aprile 2018 14:07:56 UTC+2, Matteo Lucchesi ha scritto:
>>
>> i've write a auth middleware for django channels :
>>
>> https://codeshare.io/aYnQmN
>>
>> but seem that use a persistent connection and after some hour i have the
>> erro "Mysql is gone away"
>>
>> Where is the error?
>>
> --
> 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/c8171fd2-a423-439e-b89c-813a747658a1%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/CAFwN1ur-EMmQiwf34yovNYck5SzO2B5_jYBv9cKv8F4daNbGHg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Mysql is gone away auth middleware channels 2

2018-04-05 Thread Matteo Lucchesi
Thank you very much

Il giorno giovedì 5 aprile 2018 19:14:35 UTC+2, Andrew Godwin ha scritto:
>
> You must do all database access through a synchronous function wrapped in 
> database_sync_to_async - you can't just call it directly on an asyncio 
> thread:
>
> http://channels.readthedocs.io/en/latest/topics/databases.html#database-sync-to-async
>
> Andrew
>
> On Thu, Apr 5, 2018 at 5:25 AM, Matteo Lucchesi  > wrote:
>
>> https://codeshare.io/5wlXNK
>>
>> Il giorno giovedì 5 aprile 2018 14:07:56 UTC+2, Matteo Lucchesi ha 
>> scritto:
>>>
>>> i've write a auth middleware for django channels :
>>>
>>> https://codeshare.io/aYnQmN
>>>
>>> but seem that use a persistent connection and after some hour i have the 
>>> erro "Mysql is gone away"
>>>
>>> Where is the error?
>>>
>> -- 
>> 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/c8171fd2-a423-439e-b89c-813a747658a1%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/be3d75e1-4c6e-4c46-9b37-d90b4e697cbc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to use Graphviz/Networkx in django?

2018-04-05 Thread shawnmhy
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.


Pant builds with django

2018-04-05 Thread Allan Nava
Is possible use pant builds with django?

-- 
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/079d7aeb-9666-4b49-a50c-cf469f1a5537%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Get fields annotated to a QuerySet

2018-04-05 Thread Matthew Pava
I have a QuerySet that I annotated fields based on some conditional logic, and 
then I pass that QuerySet to another function.  In that function, I'd like to 
retrieve a list of all the annotated fields on the QuerySet.  Is there any way 
to do that?

-- 
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/04c7bc944399442b9c15d5fd45f6997b%40ISS1.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.