Re: Should the settings.py template include USE_TZ = True?

2012-02-20 Thread Anssi Kääriäinen
On Feb 20, 11:24 pm, Carl Meyer wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 02/20/2012 01:59 PM, Aymeric Augustin wrote: > > > The main reason for enabling time zone support by default in new > > projects (through the settings.py template) was to store UTC in the > > database (

Re: Should the settings.py template include USE_TZ = True?

2012-02-20 Thread Aymeric Augustin
On 20 févr. 2012, at 23:52, Jacob Kaplan-Moss wrote: > But I do think we should have some help for people transitioning -- > perhaps a timezone FAQ would be in order? Jacob, That's a good idea. I've created a ticket: https://code.djangoproject.com/ticket/17738 Everyone, If you think timezones

Re: django-admin.py startproject creating duplicate settings.py files

2012-02-20 Thread Aymeric Augustin
On 21 févr. 2012, at 04:31, Yo-Yo Ma wrote: > I have trunk installed from last night, and this is actual terminal > output (except for the stuff omitted on the left of the $): > > (my_venv) myusername$ django-admin.py startproject foobarz > (my_venv) myusername$ ls foobarz/ > __init__.py foobar

Re: django-admin.py startproject creating duplicate settings.py files

2012-02-20 Thread Carl Meyer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 02/20/2012 09:19 PM, Yo-Yo Ma wrote: > (myvenv)My-Names-MacBook-Pro:dev myusername$ mkdir test_startproject > (myvenv)My-Names-MacBook-Pro:dev myusername$ cd test_startproject/ > (myvenv)My-Names-MacBook-Pro:test_startproject myusername$ ls -a > .

Re: django-admin.py startproject creating duplicate settings.py files

2012-02-20 Thread Yo-Yo Ma
Hey Carl, Thanks for the reply. I removed everything from my venv's site- packages directory (except PIL and some other graph library), then checked to make sure I wasn't able to use django-admin.py or my app's manage.py scripts (ie, making sure there wasn't a global Django install). I then reinst

Re: django-admin.py startproject creating duplicate settings.py files

2012-02-20 Thread Carl Meyer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 02/20/2012 08:31 PM, Yo-Yo Ma wrote: > I have trunk installed from last night, and this is actual terminal > output (except for the stuff omitted on the left of the $): > > (my_venv) myusername$ django-admin.py startproject foobarz > (my_venv) myus

django-admin.py startproject creating duplicate settings.py files

2012-02-20 Thread Yo-Yo Ma
I have trunk installed from last night, and this is actual terminal output (except for the stuff omitted on the left of the $): (my_venv) myusername$ django-admin.py startproject foobarz (my_venv) myusername$ ls foobarz/ __init__.py foobarz manage.py settings.py urls.py (my_v

Re: auto_now=True fields aren't updated on QuerySet.update()

2012-02-20 Thread Yo-Yo Ma
Thanks, Danny. That's really helpful to me, and I appreciate you taking the time to explain it. -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from thi

Re: auto_now=True fields aren't updated on QuerySet.update()

2012-02-20 Thread Danny Adair
On Tue, Feb 21, 2012 at 14:17, Yo-Yo Ma wrote: >[...] > When using UTC, which, if any, are true: Not sure what you mean by "using UTC", I assume you mean "USE_TZ = True". As per first sentence of https://docs.djangoproject.com/en/dev/topics/i18n/timezones/ "When support for time zones is enabled,

Request for review for a small fix in the csrf view

2012-02-20 Thread h3
I've submitted a ticket[1] with two patches as a follow-up to this discussion: http://groups.google.com/group/django-developers/browse_thread/thread/ca34924871e3c00b/b29cd0e17c010f54?lnk=gst&q=csrf+cookie+haineault#b29cd0e17c010f54 In short, the first patch add a bullet point in the CSRF error pa

Re: auto_now=True fields aren't updated on QuerySet.update()

2012-02-20 Thread Yo-Yo Ma
I actually know so little that I was even more confused by my own question, but I appreciate your reply, Danny. I feel pretty challenged when I try to understand timezone-related stuff. Is this correct: When using UTC, which, if any, are true: A) If I have a view that simply adds a record of a mo

Re: auto_now=True fields aren't updated on QuerySet.update()

2012-02-20 Thread Danny Adair
On Tue, Feb 21, 2012 at 13:17, Yo-Yo Ma wrote: > I haven't quite read up on all the UTC-related stuff in Django as of > yet (couldn't find much info about it), but I found some of the posts > above concerning. It would seem that if a DateTimeField should be > updated with ``timezone.now()``, then

Re: Re-posting of previous thread: ``QuerySet.update`` not updating ``auto_now=True`` fields

2012-02-20 Thread Carl Meyer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 02/20/2012 05:11 PM, Yo-Yo Ma wrote: > I understand that ``QuerySet.update`` issues an UPDATE SQL statement, > but Django's code could be modified to include each ``auto_now=True`` > field on a model in the UPDATE statement, setting the value to > `

Re: auto_now=True fields aren't updated on QuerySet.update()

2012-02-20 Thread Yo-Yo Ma
I haven't quite read up on all the UTC-related stuff in Django as of yet (couldn't find much info about it), but I found some of the posts above concerning. It would seem that if a DateTimeField should be updated with ``timezone.now()``, then a DateField should be updated with ``timezone.now().toda

Re-posting of previous thread: ``QuerySet.update`` not updating ``auto_now=True`` fields

2012-02-20 Thread Yo-Yo Ma
It seems my previous question was co-opted... by myself, so rather than try to distract the conversation about TZ stuff (which seems to be pretty important stuff, esp with the 1.4 launch), I figured I'd start a new thread with my original question. Here it is: If you call ``QuerySet.update`` on t

Re: auto_now=True fields aren't updated on QuerySet.update()

2012-02-20 Thread Danny Adair
On Tue, Feb 21, 2012 at 10:48, Anssi Kääriäinen wrote: >[...] > Current documentation doesn't help here. I agree that a "Timezones FAQ" should mention DateField(auto_now=True), with a reference from there also back to the FAQ. Really the complication are the timezones themselves, not the mechani

Re: Should the settings.py template include USE_TZ = True?

2012-02-20 Thread Jacob Kaplan-Moss
Donald Stufft wrote: > I'm very much pro USE_TZ = True being the default. I very much agree. I've been bitten by a few "can't use naive datetimes" errors as I've been upgrading, but these are easy bugs: they show up when running tests, and are fixed trivially. On the other hand, the kind of bugs

Re: auto_now=True fields aren't updated on QuerySet.update()

2012-02-20 Thread Anssi Kääriäinen
On Feb 20, 11:18 pm, Danny Adair wrote: > On Tue, Feb 21, 2012 at 09:29, Anssi Kääriäinen > wrote: > >[...] > >> This is by design. Timezones don't make sense for date or times, only for > >> datetimes. > > > In [15]: activate('Australia/Sydney') > > In [16]: localtime(now()).date() > > Out[16]

Re: Should the settings.py template include USE_TZ = True?

2012-02-20 Thread Anssi Kääriäinen
On Feb 20, 10:59 pm, Aymeric Augustin wrote: > (subject changed because I'm forking the discussion) > > On 20 févr. 2012, at 21:29, Anssi Kääriäinen wrote: > > > Another question I have meant to ask is if 1.4 is too early to have > > USE_TZ = True as default setting? I am afraid there are still so

Re: Should the settings.py template include USE_TZ = True?

2012-02-20 Thread Donald Stufft
On Monday, February 20, 2012 at 4:24 PM, Carl Meyer wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 02/20/2012 01:59 PM, Aymeric Augustin wrote: > > The main reason for enabling time zone support by default in new > > projects (through the settings.py template) was to store UTC in

Re: auto_now=True fields aren't updated on QuerySet.update()

2012-02-20 Thread Danny Adair
On Tue, Feb 21, 2012 at 09:29, Anssi Kääriäinen wrote: >[...] >> This is by design. Timezones don't make sense for date or times, only for >> datetimes. > > In [15]: activate('Australia/Sydney') > In [16]: localtime(now()).date() > Out[16]: datetime.date(2012, 2, 21) > In [17]: activate('Europe/H

Re: Should the settings.py template include USE_TZ = True?

2012-02-20 Thread Donald Stufft
On Monday, February 20, 2012 at 3:59 PM, Aymeric Augustin wrote: > (subject changed because I'm forking the discussion) > > On 20 févr. 2012, at 21:29, Anssi Kääriäinen wrote: > > > Another question I have meant to ask is if 1.4 is too early to have > > USE_TZ = True as default setting? I am af

Re: Should the settings.py template include USE_TZ = True?

2012-02-20 Thread Carl Meyer
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 02/20/2012 01:59 PM, Aymeric Augustin wrote: > The main reason for enabling time zone support by default in new > projects (through the settings.py template) was to store UTC in the > database (on SQLite, MySQL and Oracle; PostgreSQL always does tha

Should the settings.py template include USE_TZ = True?

2012-02-20 Thread Aymeric Augustin
(subject changed because I'm forking the discussion) On 20 févr. 2012, at 21:29, Anssi Kääriäinen wrote: > Another question I have meant to ask is if 1.4 is too early to have > USE_TZ = True as default setting? I am afraid there are still some > bugs to iron out, some documentation to improve, he

Re: auto_now=True fields aren't updated on QuerySet.update()

2012-02-20 Thread Anssi Kääriäinen
On Feb 20, 8:57 pm, Aymeric Augustin wrote: > On 20 févr. 2012, at 19:52, Yo-Yo Ma wrote: > > > On a related note, the new timezone.now() functionality is used for > > ``DateTimeField.pre_save`` when ``auto_now=True``, but it isn't used > > for ``DateField.pre_save`` or ``TimeField.pre_save``. Is

Re: auto_now=True fields aren't updated on QuerySet.update()

2012-02-20 Thread Aymeric Augustin
On 20 févr. 2012, at 19:52, Yo-Yo Ma wrote: > On a related note, the new timezone.now() functionality is used for > ``DateTimeField.pre_save`` when ``auto_now=True``, but it isn't used > for ``DateField.pre_save`` or ``TimeField.pre_save``. Is this a bug I > should report, or is there something I'

Re: auto_now=True fields aren't updated on QuerySet.update()

2012-02-20 Thread Yo-Yo Ma
On a related note, the new timezone.now() functionality is used for ``DateTimeField.pre_save`` when ``auto_now=True``, but it isn't used for ``DateField.pre_save`` or ``TimeField.pre_save``. Is this a bug I should report, or is there something I'm missing (I'm pretty uninformed when it comes to UTC

auto_now=True fields aren't updated on QuerySet.update()

2012-02-20 Thread Yo-Yo Ma
If you call ``QuerySet.update`` on the following model, you'll get the results that proceed it: # models.py class Person(models.Model): cool = models.BooleanField(default=False) updated_on=DateTimeField(auto_now=True) # django-admin.py shell >>> from myapp.models import Person >>> >>> #

Re: auth.User usernames

2012-02-20 Thread Tom Evans
On Sat, Feb 18, 2012 at 4:25 AM, Tai Lee wrote: > It's not that hard to just set up a OneToOneField back to User, and > use signals to automatically create a User when you create your own > User/Profile. Then you can still make use of 3rd party apps that rely > on contrib.auth or contrib.sessions,

Re: Could prefetch_related be modified to utilize select_related for ForeignKey relations?

2012-02-20 Thread Anssi Kääriäinen
On Feb 20, 12:18 am, Yo-Yo Ma wrote: > Speaking with regards to the ORM method documented > athttps://docs.djangoproject.com/en/dev/ref/models/querysets/#prefetch-... > > Of course, ``prefetch_related`` uses a Pythonic join to attach reverse- > related objects and avoids the N+1 queries problem,