Wednesday, August 22, 2018

Re: problems with order by month

hi Osvaldo, try filtering by date ( by month and date ), do you can filter by month and day ??? if this is what do you want, so, you  can filter by date by example: "fechanacimiento__date", so, the queryset sould be this:

Alumno.objecs.filter(.....).order_by('fechanacimiento__date') # by default is ascending, for descending add the "-" before the order keyword, by example "-fechanacimiento__date"

Good look.


____________________________________________________
Franklin Sarmiento
Full-stack developer
skype: franklin.s.dev
Twitter: @franklinitiel
linkedin: Franklin Sarmiento ( franklinitiel@gmail.com )
Teléfono(s): +57 320 490.79.64 / +58 426 273.8103 ( whatsapp )



El mié., 22 ago. 2018 a las 7:16, Phako Perez (<13.phakman@gmail.com>) escribió:
I think you miss the column to order

cardio = Alumno.objects.filter ( fechanacimiento __month = now.month).order_by('fechanacimiento')  
    Should be

    cardio = Alumno.objects.filter ( fechanacimiento __month = now.month).order_by('fechanacimiento_day')  

      Sent from my iPhone

      On Aug 21, 2018, at 6:38 PM, Osvaldo Ruso Olea <venkotandil@gmail.com> wrote:

      cardio = Alumno.objects.filter ( fechanacimiento __month = now.month).order_by('fechanacimiento')  

      --
      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+unsubscribe@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/66567EB6-0843-47ED-BB24-5F7753BE169F%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+unsubscribe@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/CAMsjBKJFGdqK9ec4ics26oFca%2BfpQ-VHaXtO4Jf%2BV9Zx72dmMw%40mail.gmail.com.
      For more options, visit https://groups.google.com/d/optout.

      No comments:

      Post a Comment