Re: A.objects.getdefault

2012-10-15 Thread Ole Laursen
On Friday, October 12, 2012 3:35:53 PM UTC+2, Chris Wilson wrote: > > I'm strongly in favour of a simple, obvious way to do the common thing, > which is to return None if the object doesn't exist, instead of throwing > an exception. My preferred method names would be .nget(), .get_or_none() > or

Re: A.objects.getdefault

2012-10-15 Thread Anssi Kääriäinen
On 10/15/2012 03:13 PM, Ole Laursen wrote: On Friday, October 12, 2012 3:35:53 PM UTC+2, Chris Wilson wrote: I'm strongly in favour of a simple, obvious way to do the common thing, which is to return None if the object doesn't exist, instead of throwing an exception. My prefe

Re: A.objects.getdefault

2012-10-15 Thread Tom Evans
On Mon, Oct 15, 2012 at 1:42 PM, Anssi Kääriäinen wrote: > On 10/15/2012 03:13 PM, Ole Laursen wrote: > > On Friday, October 12, 2012 3:35:53 PM UTC+2, Chris Wilson wrote: >> >> I'm strongly in favour of a simple, obvious way to do the common thing, >> which is to return None if the object doesn't

Re: contrib.markup deprecation

2012-10-15 Thread Waylan Limberg
On Sat, Oct 13, 2012 at 1:34 PM, Luke Plant wrote: > Hi all, > > https://code.djangoproject.com/ticket/18054 > > I just came across this, and it seems slightly hasty. Most deprecations > of entire contrib modules would require some discussion on django-devs, > I would have thought. The most rec

Proposal - ``Model.reset_state``

2012-10-15 Thread Yo-Yo Ma
Problem: a = A.objects.get(...) form = AModelForm(data={...}, instance=a) if form.is_valid(): a = form.save() else: a.calculate_foo_field() a.last_attempt = datetime.now() a.save() # Oops, now the instance has the bad data provided to the form Workarounds: # Get a fresh cop

Re: Proposal - ``Model.reset_state``

2012-10-15 Thread Alex Ogier
On Mon, Oct 15, 2012 at 12:16 PM, Yo-Yo Ma wrote: > Problem: > > a = A.objects.get(...) > form = AModelForm(data={...}, instance=a) > if form.is_valid(): > a = form.save() > else: > a.calculate_foo_field() > a.last_attempt = datetime.now() > a.save() # Oops, now the instance has

Re: A.objects.getdefault

2012-10-15 Thread Jacob Kaplan-Moss
On Mon, Oct 15, 2012 at 7:42 AM, Anssi Kääriäinen wrote: > In the end this is a decision with almost no technical considerations and a > lot of "good taste" considerations. So, this seems like BDFL area. Hi! After thinking a bit, I'm +1 on the idea, and I think `Queryset.first()` is the right na

Re: Update on localflavor move

2012-10-15 Thread Aymeric Augustin
Hi Adrian, Thanks for taking the lead on this! I reviewed related tickets in Trac and I have a few suggestions. 1) Can we move the fields defined in django.contrib.localflavor.generic.forms to django.forms? Currently the US-biased fields are in django.forms and the non-biased ones in django.

Re: A.objects.getdefault

2012-10-15 Thread Michael Hudson-Doyle
On 16 October 2012 07:19, Jacob Kaplan-Moss wrote: > On Mon, Oct 15, 2012 at 7:42 AM, Anssi Kääriäinen > wrote: >> In the end this is a decision with almost no technical considerations and a >> lot of "good taste" considerations. So, this seems like BDFL area. > > Hi! > > After thinking a bit, I'

Re: Update on localflavor move

2012-10-15 Thread Mahdi Yusuf
Hi, I have setup testing in a pull request here . If this solution is acceptable. I can duplicate the process on the other local flavours. I would appreciate feedback. -- Mahdi Yusuf On Mon, Oct 15, 2012 at 4:16 PM, Aymeric Augustin < aym