On Wed, Jul 4, 2012 at 1:59 PM, J. Javier Maestro <jjmaes...@ieee.org> wrote:
> Hi there!
>
> Thanks a lot for the reply. However, I don't think your solution would
> work in my case, nor it answers the question of whether it can be done
> or why the order_by() adds stuff to the GROUP BY clause when used in
> conjunction with values().
>
> Let's see:
>
> On Tue, Jul 3, 2012 at 11:08 PM, Bill Freeman <ke1g...@gmail.com> wrote:
>> First, I think that you're going about last_visit in the wrong way.
>> timezone.now() is evaluated once, when the module is imported,
>> rather than when the user visits.  DateTimeField's auto_now=True
>> option is tailor made for this kind of situation.
>
> I know about auto_now and, apart from the discussions that can be
> found all over the Internet, is a nice feature... unless you update
> records (like I do). Then, auto_now does nothing since it only affects
> save(). In any case, the default value is actually a leftover from the
> initial implementation, right now is not even needed.

Bill,

Re-reading the update() documentation and the way I implemented the
middleware, you are right that auto_now will be the best solution. I
will use save() instead of update() and will get that fixed.

Thanks a lot for the suggestion!  If you have any ideas about the
values() and order_by() issue, I will be happy to hear them!

Cheers,

-- 
J. Javier Maestro <jjmaes...@ieee.org>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to