Re: get all columns as a list

2016-05-23 Thread James Schneider
On Mon, May 23, 2016 at 9:20 AM, Larry Martell 
wrote:

> They're not identical - there's a timestamp - that is not one of the
> columns compared.
>
> The data is status data from a piece of equipment and we only want to
> store changes. If 2 consecutive rows come in that are the same
> (excluding the timestamp) I don't want to store the second one.
>
>
If you can coerce your incoming data into a dict using the same structure
as your model, you can probably do something like this:

new_data = {'col1': data1, 'col2': data2}
latest_db_record =
FOO.objects.filter(bar='baz').order_by('-timestamp').values('col1',
'col2')[0]

if new_data != latest_db_record:
new_data['bar'] = 'baz'
FOO.objects.create(**new_data)

Salt to taste as necessary.

You might also be able to work with qs.last() or qs.latest(), but those
return the actual objects and you can't take advantage of qs.values()
splitting it into a dict for you.

A DB transaction may also be appropriate if you have a lot of data rapidly
coming in.

-James

-- 
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%2Be%2BciWkVCzxVCOUJrPFaPM8yEQZa1oJ_3OGZ5U2Y%2BhSRJt2LQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to aggregate on insert?

2016-05-23 Thread James Schneider
On Mon, May 23, 2016 at 12:58 PM, Erik Cederstrand <
erik+li...@cederstrand.dk> wrote:

> Hi,
>
> I have inherited a legacy Item model that has a composite unique key
> consisting of a Customer ID and a per-customer, incrementing Item ID.
> Assume I can't change the model.
>
> On inserts, the legacy code would let the database increment the Item ID
> to avoid race conditions. Something like this:
>
>INSERT INTO item_table (customer_id, item_id, name, ...) VALUES (123,
> (SELECT MAX(item_id) FROM item_table WHERE customer_id =123) + 1, 'MyItem',
> ...);


> Is there any way I can do the same using the Django ORM without opening up
> for race conditions? I.e. something better than:
>
>i = Item(customer_id=123, name='MyItem', ...)
>i.item_id =
> Item.objects.filter(customer_id=123).aggregate(Max('item_id'))['item_id__max']
> + 1
>i.save()
>
>
I feel like an explicit transaction wrapping this set of queries would be
the way to go to help avoid (or at least detect) a race condition:

https://docs.djangoproject.com/en/1.9/topics/db/transactions/#controlling-transactions-explicitly

Or do I just wrap that in a loop and catch IntegrityError if I don't want
> to use raw SQL?
>

Even with the transactions in place, you'd still need to account for times
when the transaction fails. At that point the logic is up to you. I
definitely wouldn't put an infinite loop in, as there may be some other
problem that is preventing the transaction from completing, rather raise an
exception and handle it in the view accordingly. The transaction also gives
you the advantage of having a known start point (nothing incidentally
created as part of a failed operation), so it is easier to recover from.

The efficacy of this solution is also heavily dependent on your underlying
DB and the supported level of isolation. Postgres seems to be the winner in
terms of concurrency, transactions, and preemptive failure detection.

I don't believe there is a magic bullet for this case, but I'm no DB expert.

-James

-- 
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%2Be%2BciW2N2M0-O5OcO%3DeHf_RskJSQtE6wckgrWXYZ9WRwBsUjw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: UserProfile Pattern (extending User model); Migrations; New fields/columns on models.

2016-05-23 Thread Gergely Polonkai
Hello,

did you run manage.py migrate?

When you add a ForeignKey or OneToOne to a model, what actually gets stored
in the DB is the ID of the referenced object (in this case, a
auth.models.User). So the user_id column should be created for you during
the next makemigrations+migrate combo.

On a side note, giving a plural name to your models is bad practise,
especially if you use the builtin admin site.

Best,
Gergely
On May 23, 2016 18:42, "McKinley"  wrote:

> I have a Users table inside of a postgresql database in which auth_user
> also lives. I want the Users objects to have a OneToOne to the auth_user
> model. I added a line to my models.py under my Users class:
>
> user = models.OneToOneField(User, unique=True)
>
> There are probably other things wrong, because at this point my basic
> template returns this traceback:
>
> Exception Type: ProgrammingError at /scripts/users/
> Exception Value: column users.user_id does not exist
> LINE 1: SELECT "users"."id", "users"."user_id", "users"."email", "us..
>
>  I know my Users table doesn't have the user_id column. I do not know how
> to add it. Do Django users prefer to write a migration for this? Migrations
> themselves are not detecting any changes per app at all so I am completely
> flummoxed on how to add this column properly. I was going to manually do it
> in postgres, but I didn't know how to make it conform to the corresponding
> field in auth_user. Thank you for your 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/3e89ccba-dcb9-42ef-b084-c6cc4b7d6891%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/CACczBULk4THu13xFBfP2je0XDBPgMCe-aBXjNxna%3DYkaf0Q_ZQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to aggregate on insert?

2016-05-23 Thread Erik Cederstrand

> Den 23. maj 2016 kl. 22.49 skrev Ketan Bhatt :
> 
> Hey Erik,
> 
> What Django version are you on?

I'm on Django 1.9.

Erik

-- 
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/0175F099-8727-43B9-B419-4D2E48A63856%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.


Re: Complicated relationships

2016-05-23 Thread Gergely Polonkai
I would make Restaurant.dishes a @property that returns all dishes the
restaurant's chefs can make:

return Dish.objects.filter(chef__restaurant=self)
On May 23, 2016 14:46, "Jani Tiainen"  wrote:

> Something like
>
> Chef:
>   # Nothing special here, reverse relations will be done automatically
>
> Dish:
>chef = ForeignKey(Chef)
>
> Restaurant:
>chefs = ManyToMany(Chef)
>dishes = ManyToMany(Dish)
>
>
> Of course, you need to build something to make sure that restaurant
> doesn't serve dishes that it's chefs can't make.
>
>
> On 23.05.2016 15:19, Mlati Mudan wrote:
>
> I read the django documentation for a simple many-to-many relationship and
> I get it, but I'm stuck with this kind of complexity.
>
> Each restaurant employs many chefs and serves many dishes.
> Each chef can work for many restaurants and prepare many dishes.
> Each dish can only be prepared by a single chef but it can be on the menu
> of many restaurants.
>
> How do I connect these models: dish, chef, restaurant?
>
>
>
>
> --
> 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/01e504a5-bbc6-4cee-96e2-158a2803d5b7%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/5742FBA4.5010901%40gmail.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/CACczBULCJXyxtuzu%3D9Kns27qxkdwLYuFXGW1cDypktDafz8VcA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to aggregate on insert?

2016-05-23 Thread Ketan Bhatt
Hey Erik,

What Django version are you on?

On Tuesday, May 24, 2016 at 1:28:57 AM UTC+5:30, Erik Cederstrand wrote:
>
> Hi, 
>
> I have inherited a legacy Item model that has a composite unique key 
> consisting of a Customer ID and a per-customer, incrementing Item ID. 
> Assume I can't change the model. 
>
> On inserts, the legacy code would let the database increment the Item ID 
> to avoid race conditions. Something like this: 
>
>INSERT INTO item_table (customer_id, item_id, name, ...) VALUES (123, 
> (SELECT MAX(item_id) FROM item_table WHERE customer_id =123) + 1, 'MyItem', 
> ...); 
>
>
> Is there any way I can do the same using the Django ORM without opening up 
> for race conditions? I.e. something better than: 
>
>i = Item(customer_id=123, name='MyItem', ...) 
>i.item_id = 
> Item.objects.filter(customer_id=123).aggregate(Max('item_id'))['item_id__max']
>  
> + 1 
>i.save() 
>
> Or do I just wrap that in a loop and catch IntegrityError if I don't want 
> to use raw SQL? 
>
>
> Thanks, 
> Erik

-- 
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/cb1f1135-416b-44b0-8b2c-c4415ff47e69%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Reportlab no module named pdfgen

2016-05-23 Thread david rodgers
Hello All,

I am trying to use reportlab to generate pdfs from html. When I pip install 
reportlab it say its installed correctly. However, when I try 'from 
reportlab.pdfgen import canvas' I get an error saying no module named 
pdfgen. Any ideas to help solve this would be much 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/56450467-71c1-496c-9e48-a82d12660743%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to aggregate on insert?

2016-05-23 Thread Erik Cederstrand
Hi,

I have inherited a legacy Item model that has a composite unique key consisting 
of a Customer ID and a per-customer, incrementing Item ID. Assume I can't 
change the model.

On inserts, the legacy code would let the database increment the Item ID to 
avoid race conditions. Something like this:

   INSERT INTO item_table (customer_id, item_id, name, ...) VALUES (123, 
(SELECT MAX(item_id) FROM item_table WHERE customer_id =123) + 1, 'MyItem', 
...);


Is there any way I can do the same using the Django ORM without opening up for 
race conditions? I.e. something better than:

   i = Item(customer_id=123, name='MyItem', ...)
   i.item_id = 
Item.objects.filter(customer_id=123).aggregate(Max('item_id'))['item_id__max'] 
+ 1
   i.save()

Or do I just wrap that in a loop and catch IntegrityError if I don't want to 
use raw SQL?


Thanks,
Erik

-- 
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/5361025E-2D7E-49D0-A704-47A165ECC217%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.


UserProfile Pattern (extending User model); Migrations; New fields/columns on models.

2016-05-23 Thread McKinley
I have a Users table inside of a postgresql database in which auth_user 
also lives. I want the Users objects to have a OneToOne to the auth_user 
model. I added a line to my models.py under my Users class:

user = models.OneToOneField(User, unique=True)

There are probably other things wrong, because at this point my basic 
template returns this traceback:

Exception Type: ProgrammingError at /scripts/users/
Exception Value: column users.user_id does not exist
LINE 1: SELECT "users"."id", "users"."user_id", "users"."email", "us..

 I know my Users table doesn't have the user_id column. I do not know how 
to add it. Do Django users prefer to write a migration for this? Migrations 
themselves are not detecting any changes per app at all so I am completely 
flummoxed on how to add this column properly. I was going to manually do it 
in postgres, but I didn't know how to make it conform to the corresponding 
field in auth_user. Thank you for your 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/3e89ccba-dcb9-42ef-b084-c6cc4b7d6891%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: get all columns as a list

2016-05-23 Thread Ketan Bhatt
Can you not do something like

`qs.filter(...info that is coming in...).exists()` 
If ^ is True, then update it, otherwise create a new object? 

-- 
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/d9ffaeb7-f796-4d74-8ab3-1ee0cf1f5ca6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: get all columns as a list

2016-05-23 Thread Larry Martell
They're not identical - there's a timestamp - that is not one of the
columns compared.

The data is status data from a piece of equipment and we only want to
store changes. If 2 consecutive rows come in that are the same
(excluding the timestamp) I don't want to store the second one.

On Mon, May 23, 2016 at 12:14 PM, Derek  wrote:
> OK - I don't really understand that; there should not be any 2 identical
> records in a database, but anyway, that was not the issue in this thread.
>
> On Monday, 23 May 2016 11:52:06 UTC+2, larry@gmail.com wrote:
>>
>> It's only 2 consecutive rows identical rows I need to exclude.
>>
>> On Mon, May 23, 2016 at 4:53 AM, Derek  wrote:
>> > "When new data comes in I want to ... only add a new row if it differs."
>> >
>> > Pardon my curiosity, but isn't that the role of the set of unique keys
>> > for
>> > each record - to determine if it is "different"?
>> >
>> > On Friday, 20 May 2016 19:57:38 UTC+2, larry@gmail.com wrote:
>> >>
>> >> On Fri, May 20, 2016 at 2:26 AM, Gergely Polonkai 
>> >> wrote:
>> >> > Hello,
>> >> >
>> >> > Django can’t do this out of the box, but see this post[1] for a
>> >> > possible
>> >> > solution with dicts.
>> >>
>> >> Well, it seems it can. As pointed out by Erik in another post, an
>> >> empty values_list() returns all the columns, which is what I want.
>> >>
>> >> > On the other hand, I started wondering why you need this, do you care
>> >> > to
>> >> > share the use case?
>> >>
>> >> When new data comes in I want to compare it to the most recently added
>> >> row and only add a new row if it differs.
>> >>
>> >>
>> >> > [1] http://stackoverflow.com/a/29088221/1305139
>> >> > [2] https://docs.djangoproject.com/en/1.9/topics/serialization/
>> >> >
>> >> > On May 20, 2016 00:13, "Larry Martell"  wrote:
>> >> >>
>> >> >> This is probably very simple, but I just can't figure out how to do
>> >> >> it.
>> >> >>
>> >> >> I want to get all the columns in some rows as a list. I know I could
>> >> >> use values_list and flat=True and list all the columns, but is that
>> >> >> the only way?
>> >> >>
>> >> >> I want to do something like this:
>> >> >>
>> >> >> rows = FOO.objects.filter(bar='baz')
>> >> >>
>> >> >> and get a list of lists instead a list of FOO objects.

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


Re: get all columns as a list

2016-05-23 Thread Derek
OK - I don't really understand that; there should not be any 2 identical 
records in a database, but anyway, that was not the issue in this thread.

On Monday, 23 May 2016 11:52:06 UTC+2, larry@gmail.com wrote:
>
> It's only 2 consecutive rows identical rows I need to exclude. 
>
> On Mon, May 23, 2016 at 4:53 AM, Derek  
> wrote: 
> > "When new data comes in I want to ... only add a new row if it differs." 
> > 
> > Pardon my curiosity, but isn't that the role of the set of unique keys 
> for 
> > each record - to determine if it is "different"? 
> > 
> > On Friday, 20 May 2016 19:57:38 UTC+2, larry@gmail.com wrote: 
> >> 
> >> On Fri, May 20, 2016 at 2:26 AM, Gergely Polonkai  
> >> wrote: 
> >> > Hello, 
> >> > 
> >> > Django can’t do this out of the box, but see this post[1] for a 
> possible 
> >> > solution with dicts. 
> >> 
> >> Well, it seems it can. As pointed out by Erik in another post, an 
> >> empty values_list() returns all the columns, which is what I want. 
> >> 
> >> > On the other hand, I started wondering why you need this, do you care 
> to 
> >> > share the use case? 
> >> 
> >> When new data comes in I want to compare it to the most recently added 
> >> row and only add a new row if it differs. 
> >> 
> >> 
> >> > [1] http://stackoverflow.com/a/29088221/1305139 
> >> > [2] https://docs.djangoproject.com/en/1.9/topics/serialization/ 
> >> > 
> >> > On May 20, 2016 00:13, "Larry Martell"  wrote: 
> >> >> 
> >> >> This is probably very simple, but I just can't figure out how to do 
> it. 
> >> >> 
> >> >> I want to get all the columns in some rows as a list. I know I could 
> >> >> use values_list and flat=True and list all the columns, but is that 
> >> >> the only way? 
> >> >> 
> >> >> I want to do something like this: 
> >> >> 
> >> >> rows = FOO.objects.filter(bar='baz') 
> >> >> 
> >> >> and get a list of lists instead a list of FOO objects. 
> > 
> > -- 
> > 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/e4a06bdf-c9df-46a7-9848-86238ddbf7cd%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/107edd46-8ca4-4856-bd34-558de2b940e1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Query and order by time difference of a specified time.

2016-05-23 Thread Fabio C. Barrionuevo da Luz
it would probably be better to use a custom "Func"[1] and a custom "Query
Expression" [2] than user QuerySet.extra

[1] https://docs.djangoproject.com/en/1.9/ref/models/database-functions
[2] https://docs.djangoproject.com/en/1.9/ref/models/expressions/



On Mon, May 23, 2016 at 11:16 AM, Ketan Bhatt  wrote:

> Take a look at the `extra` method of the queryset in Django. It allows you
> to do what you are trying to do by raw SQL.
>
>
> https://docs.djangoproject.com/en/1.9/ref/models/querysets/#django.db.models.query.QuerySet.extra
>
> Check the above link, the example with `annotate` will be interesting for
> you.
>
> I think your aim should be to create a new field and then do a `order_by`
> and `first`.
>
> --
> 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/5b556c8b-2012-4bd7-89c5-bddbbdb4c3b9%40googlegroups.com
> .
> For more options, visit https://groups.google.com/d/optout.
>



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

http://pythonclub.com.br/

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

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

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


Query and order by time difference of a specified time.

2016-05-23 Thread Ketan Bhatt
Take a look at the `extra` method of the queryset in Django. It allows you to 
do what you are trying to do by raw SQL. 

https://docs.djangoproject.com/en/1.9/ref/models/querysets/#django.db.models.query.QuerySet.extra

Check the above link, the example with `annotate` will be interesting for you. 

I think your aim should be to create a new field and then do a `order_by` and 
`first`. 

-- 
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/5b556c8b-2012-4bd7-89c5-bddbbdb4c3b9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Aggregation / annotation over results of a subquery

2016-05-23 Thread Malcolm Box
Thanks Simon, that's exactly what I needed. I had read the aggregation 
documentation, but hadn't figured out how to get it to do what I needed.

Cheers,

Malcolm

On Friday, 20 May 2016 16:52:01 UTC+1, Simon Charette wrote:
>
> Hi Malcom,
>
> I suggest you look into the conditionnal aggregation documentation[1].
>
> from django.db.models import Case, Count, When
>
> Contact.objects.annotate(
> messages_count=Count(
> Case(When(
> messages__recipient=recipient,
> messages__status=Message.STATUS_UNREAD,
> then='messages'
> )),
> )
> ).filter(
> message_count__gte=1,
> ).order_by('-message_count')
>
> Cheers,
> Simon
>
> [1] 
> https://docs.djangoproject.com/en/1.9/ref/models/conditional-expressions/#conditional-aggregation
>
> Le vendredi 20 mai 2016 09:14:10 UTC-4, Malcolm Box a écrit :
>>
>> Hi all,
>>
>> I'm trying to get the ORM to let me sort things based on an annotation, 
>> where that annotation requires a subquery to select items to consider.
>>
>> Concrete example, given models:
>>
>> class Contact(models.Model):
>>name = models.CharField()
>>
>> class Message(models.Model):
>>   sender = models.ForeignKey(Contact, related_name='frm')
>>   recipient = models.ForeignKey(Contact, related_name='to')
>>   unread = models.BooleanField()
>>   send_time = models.DateTimeField(auto_now_add=True)
>>   
>>
>> I want to do things like "for Contact X, create a list of other contacts 
>> ordered by the number of messages to X" or "Order the contacts by number of 
>> unread messages to X"
>>
>> It seems as if annotate/aggregate should be able to do what I want, but I 
>> can't get it to produce a subquery to select the messages to count:
>>
>> Messages.objects.filter(recipient=X).count() - number of messages to X 
>> from all contacts
>>
>> Contact.objects.annotate(msg_count=Count('frm__id')) - gives number of 
>> messages from each contact, but to anyone, not just X
>>
>>
>> Contact.objects.annotate(msg_count=Count(Q(frm__recipient=X)).order_by('msg_count')
>>  
>> - gives the wrong answer for the msg_count (seems to do same as query above)
>>
>> In SQL, what I want is something like:
>>
>> select contact.name, count(message.id) from contact left outer join 
>> message on (contact.id = message.sender_id) where (message.recipient_id 
>> = X.id) group by contact.id
>>
>> But I can't get the ORM to generate SQL that looks like this.
>>
>> Any pointers/help - even "you can't do that using the ORM" would be very 
>> welcome.
>>
>> Cheers,
>>
>> Malcolm
>>
>

-- 
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/10befbe1-f958-4ce4-9c27-f048a57be79e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Complicated relationships

2016-05-23 Thread Jani Tiainen

Something like

Chef:
  # Nothing special here, reverse relations will be done automatically

Dish:
   chef = ForeignKey(Chef)

Restaurant:
   chefs = ManyToMany(Chef)
   dishes = ManyToMany(Dish)


Of course, you need to build something to make sure that restaurant 
doesn't serve dishes that it's chefs can't make.



On 23.05.2016 15:19, Mlati Mudan wrote:
I read the django documentation for a simple many-to-many relationship 
and I get it, but I'm stuck with this kind of complexity.


Each restaurant employs many chefs and serves many dishes.
Each chef can work for many restaurants and prepare many dishes.
Each dish can only be prepared by a single chef but it can be on the 
menu of many restaurants.


How do I connect these models: dish, chef, restaurant?




--
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/01e504a5-bbc6-4cee-96e2-158a2803d5b7%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/5742FBA4.5010901%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: about django framework execution sequence

2016-05-23 Thread Paulo Afonso
Hi

You can using tutorial from base project, that was what I did to understand.

https://docs.djangoproject.com/en/1.9/intro/tutorial01/
Another way, is was very useful for me the PDF book Pro Django 2nd Version.

But for what I know is:
a) First start with Setting.py, 
b) urls to call the view as users ask for it.
c) for each view render the code...

I specially advice you to study Rest Framework, after you learn that you 
will see is more easier to code, and fast.

Hope this help. 
;) 


sábado, 21 de Maio de 2016 às 17:16:34 UTC+1, zeeshan malik escreveu:
>
> anybody plz  tel me the exzact sequence of Djngo framework execution 
> like: first of all
> url call to view functions and
> then views render  the templates and data will show on page
>
>  then in case of inserting data in form how djngo execute in sequence 
> how model and form work and how ORM role in mapping form data to database
>

-- 
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/fde93b32-10fd-4cd8-8ef2-0b05831cd548%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Query and order by time difference of a specified time.

2016-05-23 Thread ap.d...@x76.eu

Hi.
I am looking for a way to find a row which is closest to a specified 
point in time, no matter if the row is before or after.


In plain SQL (using SQLite as example), it's very easy to do;

 SELECT *,
  abs(
   strftime('%s','2015-05-21 23:05:00') - strftime('%s',`created`)
 ) AS timdif
 FROM myapp_posts f ORDER BY timdif LIMIT 10;


The above snippet converts the specified date and field to epoch 
seconds, subtracts them and then sorts the query according to the 
difference.


Is it possible do this in Django without resorting to raw queries?

Thank 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/57425C4C.1050500%40x76.eu.
For more options, visit https://groups.google.com/d/optout.


Re: django 1.8 or 1.9.2 is not installed in my window 7

2016-05-23 Thread Paulo Afonso
Can you specify what you did! What do you install, and How?

You can clone github, and install since there... You can use easy_install, 
pip, and so one.

First what is your platform? Which version. That is basic you get help from 
others, we can advice but need your help too.



domingo, 22 de Maio de 2016 às 16:46:13 UTC+1, Shivam Taneja escreveu:
>
> django 1.9.2 is not installed in my window 7 in python 2.7 its indicating 
> the error
>
> C:\Python27>python setup.py install
> Traceback (most recent call last):
>   File "setup.py", line 32, in 
> version = __import__('django').get_version()
> ImportError: No module named django
>
>
>
> this type of error is showing in my command so please help me to resolve 
> this issue
>

-- 
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/9f898477-d34f-4d92-ae71-4f9856753235%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Django Deployment: Polls Tutorial: Advanced Tutorial: How to write reuseable apps

2016-05-23 Thread Kern Goretzky
New to Django. I have some Python programming experience
(beginner-intermediate). I was taking the Django Polls tutorial and can't
resolve deployment problem in the Advanced Tutorial: How to write reuseable
apps: https://docs.djangoproject.com/en/1.9/intro/reusable-apps/

In the Using Your Own Package section, I have a problem when I pip install
--user django-polls/dist/django-polls-0.1.tar.gz. I get this response:

"Requirement 'django-polls/dist/django-polls-0.1.tar.gz' looks like a
filename, but the file does not exist."

I'm using a Windows 10 computer and I noticed that the package extension is
.zip not .tar.gz

I did pip install --user django-polls/dist/django-polls-0.1.zip (changed
the extension to .zip) but had the same response:

"Requirement 'django-polls/dist/django-polls-0.1.zip' looks like a
filename, but the file does not exist."

I am doing the pip install from the dist directory. In trying to figure out
the source of the problem, I have some suspects:

   1.

   When I saveed the README.rst file in Spyder I selected the web pages
   (.css .htm .html) option but changed the extension to .rst. In file explore
   under type, it says RST File, so I thought I did this correctly. Otherwise
   I'm not sure what program to use to create an .rst file.
   2.

   I couldn't figure out what program creates a .in file type. My
   MANIFEST.in file is a text document.
   3.

   Why was a .zip file created for the package instead of a .tar.gz file?
   4.

   My LICENSE file is an .html doc. Does that matter?
   5.

   Should I have created a virtual environment? Does python manage.py
   startapp polls from the first part of the tutorial create a virtual
   environment.

I cut and pasted all of the code from the tutorial, so unless the tutorial
has a typo I think the code is probably not the problem. I also have
Anacondo installed if that makes a difference.

This is my first deployment so please dumb-down the explanations if
possible. Thank 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/CAEt1vu1f5Ve13eohi8tUADx%3D2Hxj9GJXK515bEnxFyOFoqufjQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Complicated relationships

2016-05-23 Thread Mlati Mudan
I read the django documentation for a simple many-to-many relationship and 
I get it, but I'm stuck with this kind of complexity. 

Each restaurant employs many chefs and serves many dishes. 
Each chef can work for many restaurants and prepare many dishes. 
Each dish can only be prepared by a single chef but it can be on the menu 
of many restaurants. 

How do I connect these models: dish, chef, restaurant?




-- 
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/01e504a5-bbc6-4cee-96e2-158a2803d5b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Displaying single-line progress while a management command runs

2016-05-23 Thread Phil Gyford
Belated thanks for this Erik - that does work nicely. It gets
complicated/annoying trying to untangle other kinds of logging too,
including logging from third-party modules, but that's a separate problem :)

On 9 May 2016 at 21:33, Erik Cederstrand  wrote:

>
> > Den 9. maj 2016 kl. 14.23 skrev Phil Gyford :
> >
> > I have a custom management command which calls a method in another
> class, which fetches lots of data from a third-party API. Fetching the data
> could take a few seconds or it could take over an hour, depending on the
> quantity.
> >
> > [...]
> > Things I've tried so far:
> >
> > 1) Using print(), e.g.:
> >
> > print('Fetched %d of %d' % (n, total), end='\r')
> >
> > In a loop, this nicely shows a single line that constantly updates with
> progress. But print() is nasty and when I run my unit tests, this output is
> displayed among the testing output. I assume it'll also be a pain to have
> that output when running the commands scheduled with cron (or whatever).
>
> I do this kind of progress reporting a lot. Usually, I get around the
> test/cron output pollution by adding a 'silent' argument to the management
> command which determines if the commend should print progress reports or
> not. See below.
>
> > 2) Using Django logging. This is "better" than print(), and doesn't mess
> up test output, but as far as I can tell there's no way to display a
> single, constantly updated, line showing progress. It's only going to show
> one line after another:
> >
> > Fetched 1 of 3000
> > Fetched 2 of 3000
> > Fetched 3 of 3000
>
> It's actually quite simple. You need to create a custom handler like so:
>
>   import logging
>   import time
>   from django.core.management.base import BaseCommand
>
>   class OverwriteHandler(logging.StreamHandler):
>   # The extra spaces wipe previous output in case your messages are
> wariable-width
>   terminator = ' '*80 + '\r'
>
>   log = logging.getLogger('')
>   h = OverwriteHandler()
>   log.addHandler(h)
>
>   class Command(BaseCommand):
> def handle(self, silent=False, **options):
>   log.setLevel(logging.DEBUG if silent else logging.INFO)
>   log.info('1 of 2')
>   time.sleep(1)
>   log.info('2 of 2')
>   time.sleep(1)
>
> If you want to mix normal and progress logging in your management command,
> you need to use two loggers with different handlers.
>
> Erik
>
> --
> 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/463A7786-888C-4CB0-9C68-43F855401924%40cederstrand.dk
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
http://www.gyford.com/

-- 
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/CAAU%3D2qRf6c%3DU%3DRtTAa8838NvXzxgn_aA1AF7DBA62jHuB9MaPQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: get all columns as a list

2016-05-23 Thread Larry Martell
It's only 2 consecutive rows identical rows I need to exclude.

On Mon, May 23, 2016 at 4:53 AM, Derek  wrote:
> "When new data comes in I want to ... only add a new row if it differs."
>
> Pardon my curiosity, but isn't that the role of the set of unique keys for
> each record - to determine if it is "different"?
>
> On Friday, 20 May 2016 19:57:38 UTC+2, larry@gmail.com wrote:
>>
>> On Fri, May 20, 2016 at 2:26 AM, Gergely Polonkai 
>> wrote:
>> > Hello,
>> >
>> > Django can’t do this out of the box, but see this post[1] for a possible
>> > solution with dicts.
>>
>> Well, it seems it can. As pointed out by Erik in another post, an
>> empty values_list() returns all the columns, which is what I want.
>>
>> > On the other hand, I started wondering why you need this, do you care to
>> > share the use case?
>>
>> When new data comes in I want to compare it to the most recently added
>> row and only add a new row if it differs.
>>
>>
>> > [1] http://stackoverflow.com/a/29088221/1305139
>> > [2] https://docs.djangoproject.com/en/1.9/topics/serialization/
>> >
>> > On May 20, 2016 00:13, "Larry Martell"  wrote:
>> >>
>> >> This is probably very simple, but I just can't figure out how to do it.
>> >>
>> >> I want to get all the columns in some rows as a list. I know I could
>> >> use values_list and flat=True and list all the columns, but is that
>> >> the only way?
>> >>
>> >> I want to do something like this:
>> >>
>> >> rows = FOO.objects.filter(bar='baz')
>> >>
>> >> and get a list of lists instead a list of FOO objects.
>
> --
> 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/e4a06bdf-c9df-46a7-9848-86238ddbf7cd%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/CACwCsY7%3D8tv4kDf2SDRqRsvMvg8dTb3HtqPRo5O8nkdvNHnmJA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Displaying a document

2016-05-23 Thread Derek
The users will need a browser which is capable of rendering the file or 
knowing what app it has to use - for example, on my machine (Linux) an XLS 
file is rendered directly by LibreOffice; but on a colleague's machine with 
Windows/IE they have to first download the file and then open it. So, you 
will need to provide instructions for users to configure their browsers.

On Sunday, 22 May 2016 18:36:15 UTC+2, Wilfredo Rivera wrote:
>
> I fixed it. but now the website give me the option of downloading the 
> file. How can i do for the website to display the file?
>
> On Sunday, May 22, 2016 at 8:27:10 AM UTC-7, Wilfredo Rivera wrote:
>>
>> It give me this kind of error:
>>
>>
>> Using the URLconf defined in hr_solution.urls, Django tried these URL 
>> patterns, in this order: 
>>
>>1. ^admin/ 
>>2. ^user/ 
>>3. ^$ [name='candidate_entry'] 
>>4. ^candidatelist/$ [name='candidate_list'] 
>>5. 
>> ^candidatelist/(?P\d{4})/(?P\d{1,2})/(?P\d{1,2})/(?P[-\w]*)/$
>>  
>>[name='candidate_detail'] 
>>6. 
>> ^candidatelist/(?P\d{4})/(?P\d{1,2})/(?P\d{1,2})/(?P[-\w]*)/update/$
>>  
>>[name='candidate_update'] 
>>
>> The current URL, candidatelist/resume/Resume_Wilfredo_Rivera.pdf, didn't 
>> match any of these.
>>
>>
>> How can I desing a url that match the one with the uploaded file and what 
>> view handles it?
>>
>>
>> On Saturday, May 21, 2016 at 7:56:42 PM UTC-7, luisza14 wrote:
>>>
>>>
>>> 2016-05-21 13:21 GMT-06:00 Wilfredo Rivera :
>>>
 {{candidate.resumeFile}}"
>>>
>>>
>>>
>>> {{candidate.resumeFile.name}}
>>> "
>>>
>>> Looking in your code probably you could be interested in 
>>> https://docs.djangoproject.com/ja/1.9/ref/class-based-views/generic-editing/
>>>
>>>
>>>
>>> -- 
>>> "La utopía sirve para caminar" Fernando Birri
>>>
>>>
>>>

-- 
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/2b925e3c-59b9-42ec-840f-79ebe27b8ae7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: get all columns as a list

2016-05-23 Thread Derek
*"When new data comes in I want to ... only add a new row if it differs."*

Pardon my curiosity, but isn't that the role of the set of unique keys for 
each record - to determine if it is "different"?

On Friday, 20 May 2016 19:57:38 UTC+2, larry@gmail.com wrote:
>
> On Fri, May 20, 2016 at 2:26 AM, Gergely Polonkai  > wrote: 
> > Hello, 
> > 
> > Django can’t do this out of the box, but see this post[1] for a possible 
> > solution with dicts. 
>
> Well, it seems it can. As pointed out by Erik in another post, an 
> empty values_list() returns all the columns, which is what I want. 
>
> > On the other hand, I started wondering why you need this, do you care to 
> > share the use case? 
>
> When new data comes in I want to compare it to the most recently added 
> row and only add a new row if it differs. 
>
>
> > [1] http://stackoverflow.com/a/29088221/1305139 
> > [2] https://docs.djangoproject.com/en/1.9/topics/serialization/ 
> > 
> > On May 20, 2016 00:13, "Larry Martell"  > wrote: 
> >> 
> >> This is probably very simple, but I just can't figure out how to do it. 
> >> 
> >> I want to get all the columns in some rows as a list. I know I could 
> >> use values_list and flat=True and list all the columns, but is that 
> >> the only way? 
> >> 
> >> I want to do something like this: 
> >> 
> >> rows = FOO.objects.filter(bar='baz') 
> >> 
> >> and get a list of lists instead a list of FOO objects. 
>

-- 
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/e4a06bdf-c9df-46a7-9848-86238ddbf7cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: PDF page break

2016-05-23 Thread Derek
You need to let the list know what formats and what technology you are 
using to generate the PDF.

When I use rst (reStructuredText) as my input to the generation process, 
the markup I use for a Page Break is:

.. raw:: pdf

PageBreak



On Sunday, 22 May 2016 10:57:15 UTC+2, Monu wrote:
>
> I wants to know how to use the page break for PDF having more no of rows, 
> including header and footer.
>
>
>

-- 
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/9128f050-5791-4b54-bf38-69c1ee098bef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.