Re: Reporting for Django 2

2018-04-09 Thread Avraham Serour
Do you have a question or just sharing?

On Sat, 7 Apr 2018, 1:33 ,  wrote:

> Hi
>
> I've been trying different django reporting packages with no success
>
> Apparently, all of them are developed for versions previous than Django 2.0
>
> Any help will be appreciated
>
> José
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/d176707c-b267-4730-8913-ab68b9dc64c3%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAFWa6t%2Bn2_r3JrwUKUVg-RLkb8aDqK7Q28fc-4VTuAgJtZmNpg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


no styling

2018-04-09 Thread Paul Baforh
Please, my django development page is without css. How do I go about it. 
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/8ff37f92-652c-4380-88fa-67b609147638%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django - Angular 4 Serializer for inserting Parent and child Models using single JSON post

2018-04-09 Thread Nathan Sivathanu


My requirement - I have two models TravelReq and TravelReqDetails as below

class TravelReq(models.Model): 
empid= models.CharField(max_length=7) 
startdate= models.DateField()
enddate= models.DateField()
remarks= models.CharField(max_length=30)
missionname= models.CharField(max_length=30)
def __str__(self):
return str(self.id)
class TravelReqDetails(models.Model):
 travelReqID = models.ForeignKey(TravelReq ,related_name  = 'req_details' , 
on_delete=models.CASCADE );
 travelDate= models.DateField()
 lfrom = models.CharField(max_length=30)
 to= models.CharField(max_length=30)
 remarks = models.CharField(max_length=30)
def __str__(self):
return str(self.id)

My serailizer

from  .models import TravelReq ,TravelReqDetailsfrom rest_framework import 
serializers
class TravelReqSerializer(serializers.ModelSerializer):
class Meta:
model = TravelReq
fields = ('empid' , 'startdate' ,   'enddate' , 'remarks' , 
'missionname' ,'req_details')code here

My view

from .models import TravelReq from rest_framework import viewsetsfrom 
.serializers import TravelReqSerializer 

class TravelReqViewSet(viewsets.ModelViewSet):
"""
API endpoint that allows users to be viewed or edited.
"""
queryset = TravelReq.objects.all() 
serializer_class = TravelReqSerializer

*From Angular I will be receiving below JSON as POST / PUT request . What 
is the best way to insert the master(TravelReq) and child records 
(TravelReqDetails) from a single serializer. please advice. If this is not 
the best approach ,please suggest a better / standard approach*

[
{
"empid": "32432",
"startdate": "2017-11-16",
"enddate": "2018-03-17",
"remarks": "asd",
"missionname": "asd",
"req_details": [
{
"id": 1,
"travelDate": "2017-07-18",
"lfrom": "indiaemarks",
"to": "pakistan",
"remarks": "r",
"travelReqID": <> 
},
{
"id": 2,
"travelDate": "2018-04-02",
"lfrom": "pakistan",
"to": "india",
"remarks": "rerutn remarks",
"travelReqID":  <>
}
]
},

-- 
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/816ab639-a82d-451a-9868-58ef057205b8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Reporting for Django 2

2018-04-09 Thread José Espina
Ah si, olvidé la pregunta

Is anybody using a package for reporting?

Thanks, José

2018-04-09 6:43 GMT-03:00 Avraham Serour :

> Do you have a question or just sharing?
>
> On Sat, 7 Apr 2018, 1:33 ,  wrote:
>
>> Hi
>>
>> I've been trying different django reporting packages with no success
>>
>> Apparently, all of them are developed for versions previous than Django
>> 2.0
>>
>> Any help will be appreciated
>>
>> José
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit https://groups.google.com/d/
>> msgid/django-users/d176707c-b267-4730-8913-ab68b9dc64c3%
>> 40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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/CAFWa6t%2Bn2_r3JrwUKUVg-RLkb8aDqK7Q28fc-4VTuAgJtZmNpg%
> 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/CADT%2BYwc7jhNzd%2BKvkKiHVYc1mNTmZcBNyh9KfF8P6P%3DuOgS4jw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: no styling

2018-04-09 Thread James Farris
Hi Paul,

Have you read this part of the docs? 
https://docs.djangoproject.com/en/2.0/howto/static-files/

You will need a static files directory and will need to tell Django where it is 
In settings.py

Sent from my mobile device

> On Apr 9, 2018, at 5:04 AM, Paul Baforh  wrote:
> 
> Please, my django development page is without css. How do I go about it. 
> 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/8ff37f92-652c-4380-88fa-67b609147638%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/C21BA56C-F7FD-45A1-9EFD-5F13470F40F6%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


What were your best resources in learning programming, python, ultimately django?

2018-04-09 Thread Amber Pond
What were your best resources in learning programming, python, ultimately 
django?

Hi friends!

Just starting out with some basic html and css knowledge, and I am taking 
my first python class. When you were first learning programming, what were 
you MOST influential and helpful resources? Reply to this thread so that 
others and myself can use this for reference on our journeys. 

Sites?
Books?
Projects?
Forums?
Courses?

-- 
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/76a94793-11ad-4149-8b2f-2e9f42e3c77b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: What were your best resources in learning programming, python, ultimately django?

2018-04-09 Thread Jorge Gimeno
Team Treehouse was a great learning resource. It's paid, but I felt it was
worth it.

-Jorge L. Gimeno

On Mon, Apr 9, 2018, 8:06 AM Amber Pond  wrote:

> What were your best resources in learning programming, python, ultimately
> django?
>
> Hi friends!
>
> Just starting out with some basic html and css knowledge, and I am taking
> my first python class. When you were first learning programming, what were
> you MOST influential and helpful resources? Reply to this thread so that
> others and myself can use this for reference on our journeys.
>
> Sites?
> Books?
> Projects?
> Forums?
> Courses?
>
> --
> 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/76a94793-11ad-4149-8b2f-2e9f42e3c77b%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/CANfN%3DK9d%3DuHi2gxeCxRpXPMxq6f%3DJLdrLzfbevzLEJcMw_BB%3Dw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: What were your best resources in learning programming, python, ultimately django?

2018-04-09 Thread Mateusz Kurowski
https://www.youtube.com/watch?v=HTLu2DFOdTg&list=PLRVdut2KPAguz3xcd22i_o_onnmDKj3MA
https://www.youtube.com/watch?v=7lmCu8wz8ro&list=PLOAwbpVBkzASOH-SzAq8NMI7H-Eo-Vql8
https://www.youtube.com/watch?v=tkwZ1jG3XgA&list=PLOAwbpVBkzAQtFNxWpbeDAGRacBn6aL7t&index=7
https://www.youtube.com/watch?v=Zo5q48BG8A4&index=8&list=PLOAwbpVBkzAQtFNxWpbeDAGRacBn6aL7t


2018-04-09 16:56 GMT+02:00 Amber Pond :

> What were your best resources in learning programming, python, ultimately
> django?
>
> Hi friends!
>
> Just starting out with some basic html and css knowledge, and I am taking
> my first python class. When you were first learning programming, what were
> you MOST influential and helpful resources? Reply to this thread so that
> others and myself can use this for reference on our journeys.
>
> Sites?
> Books?
> Projects?
> Forums?
> Courses?
>
> --
> 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/76a94793-11ad-4149-8b2f-2e9f42e3c77b%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

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


Re: What were your best resources in learning programming, python, ultimately django?

2018-04-09 Thread James Farris
Early on Lynda.com was my best friend for learning basics like HTML and CSS. 
Then a lot of practice. 

Later on I took a coding boot camp in my area that really accelerated my 
learning and filled in a lot of the missing pieces. It covered HTML, CSS, PHP, 
Ruby on Rails and SQL to name a few. 

The Django docs and “The Django Book” https://djangobook.com/ we’re both great 
to get me started on Django. Also Lynda.com again for python and Django.

-James

> On Apr 9, 2018, at 8:15 AM, Mateusz Kurowski  
> wrote:
> 
> https://www.youtube.com/watch?v=HTLu2DFOdTg&list=PLRVdut2KPAguz3xcd22i_o_onnmDKj3MA
> https://www.youtube.com/watch?v=7lmCu8wz8ro&list=PLOAwbpVBkzASOH-SzAq8NMI7H-Eo-Vql8
> https://www.youtube.com/watch?v=tkwZ1jG3XgA&list=PLOAwbpVBkzAQtFNxWpbeDAGRacBn6aL7t&index=7
> https://www.youtube.com/watch?v=Zo5q48BG8A4&index=8&list=PLOAwbpVBkzAQtFNxWpbeDAGRacBn6aL7t
> 
> 
> 2018-04-09 16:56 GMT+02:00 Amber Pond :
>> What were your best resources in learning programming, python, ultimately 
>> django?
>> 
>> Hi friends!
>> 
>> Just starting out with some basic html and css knowledge, and I am taking my 
>> first python class. When you were first learning programming, what were you 
>> MOST influential and helpful resources? Reply to this thread so that others 
>> and myself can use this for reference on our journeys. 
>> 
>> Sites?
>> Books?
>> Projects?
>> Forums?
>> Courses?
>> -- 
>> 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/76a94793-11ad-4149-8b2f-2e9f42e3c77b%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAO_JuYMMVB_EK_zDi_y4GAfjM08Nsxgyez5sPoTabnp2SySAXg%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/BA1CD3E2-AFB7-476C-9731-06C419502BB2%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: What were your best resources in learning programming, python, ultimately django?

2018-04-09 Thread jacob duyon
Do the class completely. Don't skip anything, especially things that are
hard. Always try to figure something out on your own, and take breaks when
you are completely stuck. If you are ever stuck, ask yourself why you are
stuck, and usually its because you don't understand some dependency. Google
everything about that thing until you fully understand that well. Then,
come back to the problem. Getting stuck and persevering are the fastest
ways to learn something, so don't be fearful of that process.

Tango with Django is the first interactive book I've read for Django. I
started by making some silly website I was interested in as quickly as I
could. Then, I went back and rebuilt it by writing tests for everything.
When you are prototyping to see how something works, don't bother with unit
tests. When you are prototyping you want to get an idea of how to design
the code. Just make sure to re-build it while writing unit tests.

Learning how to test things is the most important thing to learn early on.
When you write tests for your project, you are not only testing that the
thing works.. but also are writing documentation about how to use it.





On Mon, Apr 9, 2018 at 11:15 AM, Mateusz Kurowski <
kont...@mateuszkurowski.pl> wrote:

> https://www.youtube.com/watch?v=HTLu2DFOdTg&list=PLRVdut2KPAguz3xcd22i_o_
> onnmDKj3MA
> https://www.youtube.com/watch?v=7lmCu8wz8ro&list=
> PLOAwbpVBkzASOH-SzAq8NMI7H-Eo-Vql8
> https://www.youtube.com/watch?v=tkwZ1jG3XgA&list=
> PLOAwbpVBkzAQtFNxWpbeDAGRacBn6aL7t&index=7
> https://www.youtube.com/watch?v=Zo5q48BG8A4&index=8&list=
> PLOAwbpVBkzAQtFNxWpbeDAGRacBn6aL7t
>
>
> 2018-04-09 16:56 GMT+02:00 Amber Pond :
>
>> What were your best resources in learning programming, python, ultimately
>> django?
>>
>> Hi friends!
>>
>> Just starting out with some basic html and css knowledge, and I am taking
>> my first python class. When you were first learning programming, what were
>> you MOST influential and helpful resources? Reply to this thread so that
>> others and myself can use this for reference on our journeys.
>>
>> Sites?
>> Books?
>> Projects?
>> Forums?
>> Courses?
>>
>> --
>> 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/76a94793-11ad-4149-8b2f-2e9f42e3c77b%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-users/CAO_JuYMMVB_EK_zDi_y4GAfjM08Nsxgyez5sPoTabnp2SySA
> Xg%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/CAJsZ3R4dzq2TabyN16vC21FuvELhTQuiBtrybGVOOC-16a1yRw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Django blocking on writing logs

2018-04-09 Thread Avraham Serour
It seems you are right, I found this SO thread dealing with the same
question:
https://stackoverflow.com/questions/34349797/are-log-statements-blocking-in-django-python

In pratical terms I use sentry, the python client claims to use a threaded
async approach, I suggest taking a look at their implementation, or just
plugging sentry to your app.

On Thu, Apr 5, 2018 at 7:51 PM, 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.
>

-- 
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/CAFWa6tKBZ5Nq8BwOVBWxpyg%3DS6nzV_%3DhXF_km9A-bT_pFXfbtw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Pant builds with django

2018-04-09 Thread Avraham Serour
what is pant builds?

On Thu, Apr 5, 2018 at 11:24 PM, Allan Nava  wrote:

> 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.
>

-- 
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/CAFWa6t%2BH3SM6U8X-Sq819bTG1p2Zy0g%2BDWsgneQNo1D5w2Rb-g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help: 'django.utils.six.moves' is not a package

2018-04-09 Thread Avraham Serour
sounds like django 2 removed six and some library you are using still hopes
it exists.

what django version are you using?

On Mon, Apr 9, 2018 at 3:39 AM, Derek Zeng  wrote:

> I got the following error when running pytest in django. Help is
> appreciated.
>
> This is the test I run
>
> import pytest
> from .factories import *
>
> @pytest.mark.django_db
> def test_with_client(client):
>   PostFactory.create() # if commented out, the error is gone
>   response = client.get('/')
>
>   body = str(response.content)
>   assert 'Mysite' in body
>
> PostFactory creates a Post object in the database
>
>
> apps/blog/tests/test_post.py:5 (test_with_client)
> client = 
> @pytest.mark.django_db
> def test_with_client(client):
> p = PostFactory.create()
>
> > response = client.get('/')
> blog/tests/test_post.py:10:
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _ _ _
> ../../../../.virtualenvs/django/lib/python3.6/site-
> packages/django/test/client.py:517: in get
> response = super().get(path, data=data, secure=secure, **extra)
> ../../../../.virtualenvs/django/lib/python3.6/site-
> packages/django/test/client.py:332: in get
> return self.generic('GET', path, secure=secure, **r)
> ../../../../.virtualenvs/django/lib/python3.6/site-
> packages/django/test/client.py:404: in generic
> return self.request(**r)
> ../../../../.virtualenvs/django/lib/python3.6/site-
> packages/django/test/client.py:467: in request
> response = self.handler(environ)
> ../../../../.virtualenvs/django/lib/python3.6/site-
> packages/django/test/client.py:125: in __call__
> self.load_middleware()
> ../../../../.virtualenvs/django/lib/python3.6/site-
> packages/django/core/handlers/base.py:37: in load_middleware
> middleware = import_string(middleware_path)
> ../../../../.virtualenvs/django/lib/python3.6/site-
> packages/django/utils/module_loading.py:17: in import_string
> module = import_module(module_path)
> ../../../../.virtualenvs/django/lib/python3.6/importlib/__init__.py:126:
> in import_module
> return _bootstrap._gcd_import(name[level:], package, level)
> :994: in _gcd_import
> ???
> :971: in _find_and_load
> ???
> :955: in _find_and_load_unlocked
> ???
> :665: in _load_unlocked
> ???
> :678: in exec_module
> ???
> :219: in _call_with_frames_removed
> ???
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _ _ _
> from __future__ import absolute_import
>
> import re
>
> from django import http
> from django.apps import apps
> from django.utils.cache import patch_vary_headers
> > from django.utils.six.moves.urllib.parse import urlparse
> E ModuleNotFoundError: No module named 'django.utils.six.moves.urllib';
> 'django.utils.six.moves' is not a package
> ../../../../.virtualenvs/django/lib/python3.6/site-packages/corsheaders/middleware.py:8:
> ModuleNotFoundError
>
> --
> 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/23957c7e-9aca-4494-a06a-20cbf0fc857b%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/CAFWa6tJVq15fdBc8u%3DP6tRsrJo5D0sHNQtZh1a6U2y4uNm38mw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: serializers

2018-04-09 Thread Avraham Serour
Can you phrase the question better? The way it is written makes it hard to
understand exactly what you need here.

On Thu, Apr 5, 2018 at 5:33 PM, siva.gatti  wrote:

> 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.
>

-- 
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/CAFWa6tJFuaVnQ-5w_kQeJB99_8U_h6RwVEJH0gdxoK5zfDA_mQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is a Complex filter with __in and __exact possible?

2018-04-09 Thread Tassilo Karge
Probably I should not post into a ten-year old thread, 
but it was this thread which helped me in my problem, so I want to share
my solution to the problem in case anyone else finds this.

Am Samstag, 7. März 2009 06:00:55 UTC+1 schrieb Malcolm Tredinnick:
>
> One day I'll stop posting in this thread. Really.
>
> On Sat, 2009-03-07 at 12:03 +1100, Malcolm Tredinnick wrote:
>
> > However, find things that are simultaneously in all those categories can
> > be done without all the annotation nonsense I posted. Simply
> > 
> > 
> Publication.objects.filter(article=1).filter(article=2).filter(article=3)
>
 
I tried that solution, and it works, but as you said is slow. One thing to 
note is
that it includes tables with at least those three articles, so another 
query is needed
to exclude the remaining ones (if an exact matching is what we are looking 
for).

> 
> > It's a short loop to build up such a set dynamically. The difference
> > between that (3 filter calls) and you Q-object version is described in
> > the documentation:
> > 
> http://docs.djangoproject.com/en/dev/topics/db/queries/#spanning-multi-valued-relationships
>
> I forgot to mention that this approach is probably only practical for a
> small number of article instances. Each filter() adds a new table join,
> so at some point the database will complain. Either literally, about too
> many joins, or by taking ages to attempt to optimise and execute the
> query.
>

Exactly, in my tests I found a large difference even with only about 20 
joins
and 300 objects in the database. Definitely nothing for performance.
 

> For a large number of article instances, the annotation-based solution I
> gave earlier is more appropriate.
>

It does not filter exactly however: If one of the articles is contained, and
the num_cats is coincidentially exactly 3, it will include the article.
But I wrote, based on your annotation suggestion, a working solution
for exact matching of a many-to-many field:

def many_to_many_exact(manager, fieldname, foreign_keys, foreign_manager):
   from django.db.models import Count
   result = manager
   filter_dict = {fieldname + '__in': foreign_keys}
   result = result.filter(**filter_dict)
   count_name = 'count_' + fieldname
   annotate_dict = {count_name: Count(fieldname)}
   filter_dict = {count_name: len(foreign_keys)}
   result = result.annotate(**annotate_dict).filter(**filter_dict)
   exclude_dict = {fieldname + '__in': 
foreign_manager.exclude(pk__in=foreign_keys)}
   return result.exclude(**exclude_dict)

 
As for the example, this would be the same as the following code:

Book.objects
   .filter(categories__in=[1, 2, 3])
   .annotate(num_cats=Count('categories'))
   .filter(num_cats=3)
   .exclude(categories__in=Categories.objects.exclude(pk__in=[1, 2, 3]))


All of the above code, including the categories for exclude, are executed 
in one query.
Probably the categories of a book are way less than the number
of existing categories, thus the database system will be smart and check
them against an index in the exclusion part.
The resulting query has the following structure:

SELECT table.*, COUNT(many_to_many_table.related_id) AS "count_related" 
FROM table INNER JOIN many_to_many_table 
   ON (table.id = many_to_many_table.table_id) 
WHERE (many_to_many_table.related_id IN ( ...(e.g. 1,2,3) ) 
   AND NOT (table.id IN 
  (SELECT V1.table_id FROM many_to_many_table V1 
   WHERE V1.related_id IN 
 (SELECT U0.id FROM related U0 
  WHERE NOT (U0.id IN ( ...(same as above) ))
GROUP BY table.id
HAVING COUNT(many_to_many_table.related_id) = ...(e.g. 3)


Of course there are two nestings, but I am afraid 
it is not to be solved more efficiently without custom sql.

Best regards,
Tassilo

>

-- 
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/398bcfa2-9d26-4064-8694-55a65410d0c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help: 'django.utils.six.moves' is not a package

2018-04-09 Thread Derek Zeng
I'm using django 2.0.
What exactly is the purpose of django.utils.six.moves module?
I have read the source but don't quite understand. Seems like a poly-fill
of pre-existing libraries like urllib


On Mon, Apr 9, 2018 at 3:47 PM, Avraham Serour  wrote:

> sounds like django 2 removed six and some library you are using still
> hopes it exists.
>
> what django version are you using?
>
> On Mon, Apr 9, 2018 at 3:39 AM, Derek Zeng  wrote:
>
>> I got the following error when running pytest in django. Help is
>> appreciated.
>>
>> This is the test I run
>>
>> import pytest
>> from .factories import *
>>
>> @pytest.mark.django_db
>> def test_with_client(client):
>>   PostFactory.create() # if commented out, the error is gone
>>   response = client.get('/')
>>
>>   body = str(response.content)
>>   assert 'Mysite' in body
>>
>> PostFactory creates a Post object in the database
>>
>>
>> apps/blog/tests/test_post.py:5 (test_with_client)
>> client = 
>> @pytest.mark.django_db
>> def test_with_client(client):
>> p = PostFactory.create()
>>
>> > response = client.get('/')
>> blog/tests/test_post.py:10:
>> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>> _ _ _
>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:517:
>> in get
>> response = super().get(path, data=data, secure=secure, **extra)
>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:332:
>> in get
>> return self.generic('GET', path, secure=secure, **r)
>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:404:
>> in generic
>> return self.request(**r)
>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:467:
>> in request
>> response = self.handler(environ)
>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:125:
>> in __call__
>> self.load_middleware()
>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/
>> django/core/handlers/base.py:37: in load_middleware
>> middleware = import_string(middleware_path)
>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/
>> django/utils/module_loading.py:17: in import_string
>> module = import_module(module_path)
>> ../../../../.virtualenvs/django/lib/python3.6/importlib/__init__.py:126:
>> in import_module
>> return _bootstrap._gcd_import(name[level:], package, level)
>> :994: in _gcd_import
>> ???
>> :971: in _find_and_load
>> ???
>> :955: in _find_and_load_unlocked
>> ???
>> :665: in _load_unlocked
>> ???
>> :678: in exec_module
>> ???
>> :219: in _call_with_frames_removed
>> ???
>> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>> _ _ _
>> from __future__ import absolute_import
>>
>> import re
>>
>> from django import http
>> from django.apps import apps
>> from django.utils.cache import patch_vary_headers
>> > from django.utils.six.moves.urllib.parse import urlparse
>> E ModuleNotFoundError: No module named 'django.utils.six.moves.urllib';
>> 'django.utils.six.moves' is not a package
>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/corsheaders/middleware.py:8:
>> ModuleNotFoundError
>>
>> --
>> 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/23957c7e-9aca-4494-a06a-20cbf0fc857b%40googlegroups.com
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "Django users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/django-users/EmfIjFICjyU/unsubscribe.
> To unsubscribe from this group and all its topics, 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/CAFWa6tJVq15fdBc8u%3DP6tRsrJo5D0sHNQtZh1a6U2y4uNm
> 38mw%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-us

Re: What were your best resources in learning programming, python, ultimately django?

2018-04-09 Thread Amber Pond
Thanks! I can't wait to watch these. I'll let you know if it helped me. At 
quick glance I may not be advanced enough to benefit from them yet.

On Monday, April 9, 2018 at 11:16:46 AM UTC-4, Mateusz Kurowski wrote:
>
>
> https://www.youtube.com/watch?v=HTLu2DFOdTg&list=PLRVdut2KPAguz3xcd22i_o_onnmDKj3MA
>
> https://www.youtube.com/watch?v=7lmCu8wz8ro&list=PLOAwbpVBkzASOH-SzAq8NMI7H-Eo-Vql8
>
> https://www.youtube.com/watch?v=tkwZ1jG3XgA&list=PLOAwbpVBkzAQtFNxWpbeDAGRacBn6aL7t&index=7
>
> https://www.youtube.com/watch?v=Zo5q48BG8A4&index=8&list=PLOAwbpVBkzAQtFNxWpbeDAGRacBn6aL7t
>
>
> 2018-04-09 16:56 GMT+02:00 Amber Pond >:
>
>> What were your best resources in learning programming, python, ultimately 
>> django?
>>
>> Hi friends!
>>
>> Just starting out with some basic html and css knowledge, and I am taking 
>> my first python class. When you were first learning programming, what were 
>> you MOST influential and helpful resources? Reply to this thread so that 
>> others and myself can use this for reference on our journeys. 
>>
>> Sites?
>> Books?
>> Projects?
>> Forums?
>> Courses?
>>
>> -- 
>> 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/76a94793-11ad-4149-8b2f-2e9f42e3c77b%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/636ea851-6df6-43a7-83dd-bad7226f6eab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: What were your best resources in learning programming, python, ultimately django?

2018-04-09 Thread Amber Pond
Yes! team treehouse is the only resource I paid for (besides college 
*groan*), but it reay worked for me. I used it for the ruby on rails 
class, but I should definitely use it for the python and django courses. 

On Monday, April 9, 2018 at 11:11:01 AM UTC-4, jlgimeno71 wrote:
>
> Team Treehouse was a great learning resource. It's paid, but I felt it was 
> worth it.
>
> -Jorge L. Gimeno 
>
> On Mon, Apr 9, 2018, 8:06 AM Amber Pond > 
> wrote:
>
>> What were your best resources in learning programming, python, ultimately 
>> django?
>>
>> Hi friends!
>>
>> Just starting out with some basic html and css knowledge, and I am taking 
>> my first python class. When you were first learning programming, what were 
>> you MOST influential and helpful resources? Reply to this thread so that 
>> others and myself can use this for reference on our journeys. 
>>
>> Sites?
>> Books?
>> Projects?
>> Forums?
>> Courses?
>>
>> -- 
>> 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/76a94793-11ad-4149-8b2f-2e9f42e3c77b%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/7f8cf9e8-8fd9-4fd5-b310-ab0b5608b4b0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: What were your best resources in learning programming, python, ultimately django?

2018-04-09 Thread Amber Pond
lynda.com has been recommended to me once before. Maybe its time I take it 
seriously lol! I'm taking a "principles in programming" class at college, 
and its really filling in a lot of knowledge gaps and accelerating what I'm 
learning, so I definitely agree with you there. I've not heard of "The 
Django book" (although I'm sure I will have, if i keep hanging around these 
forums and groups), but i've bookmarked it now! Thanks for sharing. 

On Monday, April 9, 2018 at 12:21:48 PM UTC-4, James Farris wrote:
>
> Early on Lynda.com was my best friend for learning basics like HTML and 
> CSS. Then a lot of practice. 
>
> Later on I took a coding boot camp in my area that really accelerated my 
> learning and filled in a lot of the missing pieces. It covered HTML, CSS, 
> PHP, Ruby on Rails and SQL to name a few. 
>
> The Django docs and “The Django Book” https://djangobook.com/ we’re both 
> great to get me started on Django. Also Lynda.com again for python and 
> Django.
>
> -James
>
> On Apr 9, 2018, at 8:15 AM, Mateusz Kurowski  > wrote:
>
>
> https://www.youtube.com/watch?v=HTLu2DFOdTg&list=PLRVdut2KPAguz3xcd22i_o_onnmDKj3MA
>
> https://www.youtube.com/watch?v=7lmCu8wz8ro&list=PLOAwbpVBkzASOH-SzAq8NMI7H-Eo-Vql8
>
> https://www.youtube.com/watch?v=tkwZ1jG3XgA&list=PLOAwbpVBkzAQtFNxWpbeDAGRacBn6aL7t&index=7
>
> https://www.youtube.com/watch?v=Zo5q48BG8A4&index=8&list=PLOAwbpVBkzAQtFNxWpbeDAGRacBn6aL7t
>
>
> 2018-04-09 16:56 GMT+02:00 Amber Pond >:
>
>> What were your best resources in learning programming, python, ultimately 
>> django?
>>
>> Hi friends!
>>
>> Just starting out with some basic html and css knowledge, and I am taking 
>> my first python class. When you were first learning programming, what were 
>> you MOST influential and helpful resources? Reply to this thread so that 
>> others and myself can use this for reference on our journeys. 
>>
>> Sites?
>> Books?
>> Projects?
>> Forums?
>> Courses?
>>
>> -- 
>> 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/76a94793-11ad-4149-8b2f-2e9f42e3c77b%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-users...@googlegroups.com .
> To post to this group, send email to django...@googlegroups.com 
> .
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-users/CAO_JuYMMVB_EK_zDi_y4GAfjM08Nsxgyez5sPoTabnp2SySAXg%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/04ce812b-554f-47d3-8afc-b9942dd12fb1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: What were your best resources in learning programming, python, ultimately django?

2018-04-09 Thread Amber Pond
YES! The last two times I was stuck, it was because of formatting, (for 
example:  format("something", .2f)). I still havent got it figured out 
completely rules and syntax wise, but it did point out that I was stuck 
because I didnt fully understand something. I also feel like i'm going to 
be revisiting the latter half of your comment when I'm in action. My 
current teacher said that documentation is one of the most important and 
underrated aspects of programming. How much of that do you agree with?

On Monday, April 9, 2018 at 12:38:31 PM UTC-4, jacob duyon wrote:
>
> Do the class completely. Don't skip anything, especially things that are 
> hard. Always try to figure something out on your own, and take breaks when 
> you are completely stuck. If you are ever stuck, ask yourself why you are 
> stuck, and usually its because you don't understand some dependency. Google 
> everything about that thing until you fully understand that well. Then, 
> come back to the problem. Getting stuck and persevering are the fastest 
> ways to learn something, so don't be fearful of that process. 
>
> Tango with Django is the first interactive book I've read for Django. I 
> started by making some silly website I was interested in as quickly as I 
> could. Then, I went back and rebuilt it by writing tests for everything. 
> When you are prototyping to see how something works, don't bother with unit 
> tests. When you are prototyping you want to get an idea of how to design 
> the code. Just make sure to re-build it while writing unit tests.
>
> Learning how to test things is the most important thing to learn early on. 
> When you write tests for your project, you are not only testing that the 
> thing works.. but also are writing documentation about how to use it. 
>
>
>
>
>
> On Mon, Apr 9, 2018 at 11:15 AM, Mateusz Kurowski <
> kon...@mateuszkurowski.pl > wrote:
>
>>
>> https://www.youtube.com/watch?v=HTLu2DFOdTg&list=PLRVdut2KPAguz3xcd22i_o_onnmDKj3MA
>>
>> https://www.youtube.com/watch?v=7lmCu8wz8ro&list=PLOAwbpVBkzASOH-SzAq8NMI7H-Eo-Vql8
>>
>> https://www.youtube.com/watch?v=tkwZ1jG3XgA&list=PLOAwbpVBkzAQtFNxWpbeDAGRacBn6aL7t&index=7
>>
>> https://www.youtube.com/watch?v=Zo5q48BG8A4&index=8&list=PLOAwbpVBkzAQtFNxWpbeDAGRacBn6aL7t
>>
>>
>> 2018-04-09 16:56 GMT+02:00 Amber Pond >:
>>
>>> What were your best resources in learning programming, python, 
>>> ultimately django?
>>>
>>> Hi friends!
>>>
>>> Just starting out with some basic html and css knowledge, and I am 
>>> taking my first python class. When you were first learning programming, 
>>> what were you MOST influential and helpful resources? Reply to this thread 
>>> so that others and myself can use this for reference on our journeys. 
>>>
>>> Sites?
>>> Books?
>>> Projects?
>>> Forums?
>>> Courses?
>>>
>>> -- 
>>> 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/76a94793-11ad-4149-8b2f-2e9f42e3c77b%40googlegroups.com
>>>  
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com .
>> To post to this group, send email to django...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/CAO_JuYMMVB_EK_zDi_y4GAfjM08Nsxgyez5sPoTabnp2SySAXg%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/91486a7a-23ed-41b3-93b0-8a52747a5fff%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Help: 'django.utils.six.moves' is not a package

2018-04-09 Thread Babatunde Akinyanmi
On Tue, 10 Apr 2018, 02:47 Derek Zeng,  wrote:

> I'm using django 2.0.
> What exactly is the purpose of django.utils.six.moves module?
>
Allowing a code base to be able to run on both python 2 and python 3

I have read the source but don't quite understand. Seems like a poly-fill
> of pre-existing libraries like urllib
>
>
> On Mon, Apr 9, 2018 at 3:47 PM, Avraham Serour  wrote:
>
>> sounds like django 2 removed six and some library you are using still
>> hopes it exists.
>>
>> what django version are you using?
>>
>> On Mon, Apr 9, 2018 at 3:39 AM, Derek Zeng  wrote:
>>
>>> I got the following error when running pytest in django. Help is
>>> appreciated.
>>>
>>> This is the test I run
>>>
>>> import pytest
>>> from .factories import *
>>>
>>> @pytest.mark.django_db
>>> def test_with_client(client):
>>>   PostFactory.create() # if commented out, the error is gone
>>>   response = client.get('/')
>>>
>>>   body = str(response.content)
>>>   assert 'Mysite' in body
>>>
>>> PostFactory creates a Post object in the database
>>>
>>>
>>> apps/blog/tests/test_post.py:5 (test_with_client)
>>> client = 
>>> @pytest.mark.django_db
>>> def test_with_client(client):
>>> p = PostFactory.create()
>>>
>>> > response = client.get('/')
>>> blog/tests/test_post.py:10:
>>> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>>> _ _ _ _
>>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:517:
>>> in get
>>> response = super().get(path, data=data, secure=secure, **extra)
>>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:332:
>>> in get
>>> return self.generic('GET', path, secure=secure, **r)
>>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:404:
>>> in generic
>>> return self.request(**r)
>>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:467:
>>> in request
>>> response = self.handler(environ)
>>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/django/test/client.py:125:
>>> in __call__
>>> self.load_middleware()
>>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/django/core/handlers/base.py:37:
>>> in load_middleware
>>> middleware = import_string(middleware_path)
>>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/django/utils/module_loading.py:17:
>>> in import_string
>>> module = import_module(module_path)
>>> ../../../../.virtualenvs/django/lib/python3.6/importlib/__init__.py:126:
>>> in import_module
>>> return _bootstrap._gcd_import(name[level:], package, level)
>>> :994: in _gcd_import
>>> ???
>>> :971: in _find_and_load
>>> ???
>>> :955: in _find_and_load_unlocked
>>> ???
>>> :665: in _load_unlocked
>>> ???
>>> :678: in exec_module
>>> ???
>>> :219: in _call_with_frames_removed
>>> ???
>>> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>>> _ _ _ _
>>> from __future__ import absolute_import
>>>
>>> import re
>>>
>>> from django import http
>>> from django.apps import apps
>>> from django.utils.cache import patch_vary_headers
>>> > from django.utils.six.moves.urllib.parse import urlparse
>>> E ModuleNotFoundError: No module named 'django.utils.six.moves.urllib';
>>> 'django.utils.six.moves' is not a package
>>> ../../../../.virtualenvs/django/lib/python3.6/site-packages/corsheaders/middleware.py:8:
>>> ModuleNotFoundError
>>>
>>> --
>>> 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/23957c7e-9aca-4494-a06a-20cbf0fc857b%40googlegroups.com
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Django users" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/django-users/EmfIjFICjyU/unsubscribe.
>> To unsubscribe from this group and all its topics, 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/CAFWa6tJVq15fdBc8u%3DP6tRsrJo5D0sHNQtZh1a6U2y4uNm38mw%40mail.gmail.com
>> 
>> .
>>
>> For more options, 

OAuth2 Token Generation in Django 1.11

2018-04-09 Thread Haroon Ahmed
Hi,

I am using Django 1.9.8 and implemented OAuth2, but when i upgrade 
django to 1.11 my to OAuth2 Token generation gets errors,
this is my code to generate token:

*   data = [*
*  ('grant_type', 'password'),*
*  ('username', userName),*
*  ('password', password),*
*]*
*   accessTokenObj = requests.post(coreUrl, data=data, verify=False, 
auth=(DjangoApp_ClientId, DjangoApp_ClientSecret))*

Any kind of hep will be appreciated in advance.

Regards,
Haroon Ahmed

-- 
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/0964f3b5-4233-471e-960d-4c5ea36bef5c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django and Live Chat

2018-04-09 Thread Haroon Ahmed
Hi,

I am using Django 1.9.8 and Python 3.4.4, will upgrade my django to 
1.11,
I want to create Chat functionality in my project, My requirement is 
that application users can Live chat with Admin users and maintain chat 
history of each user!
Please suggest some packages or solution that i can customize according 
to my requirement!

Any kind of hep will be appreciated in advance.

Regards,
Haroon Ahmed

-- 
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/e0ecc853-c23f-497f-ad4a-49cf3b78fe56%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.