These are chat archives for django/django

10th
Jul 2017
Anish Shrestha
@annshress
Jul 10 2017 13:15
@Dragonwarrior47 I dont think annotations are being deprecated soon(correct me if i am wrong!).
And you can use annotation with group_by to solve your issue
Kanhaiya Lal
@Dragonwarrior47
Jul 10 2017 13:52
@annshress I want my rows to be grouped in every two hours interval,I am saying extra method will be depracated not annotation
@flyboy1565 Can you explain what exactly are you doing
I don't think its the same what I want to achieve
Luke-VideoLibre
@LukeVideo
Jul 10 2017 13:58
Hy. How would i get DjangoRestFramework to do more than fetch data from a model. I wonder how i could use these serialized values to make a custom call to a second API and put that in my response?
Anish Shrestha
@annshress
Jul 10 2017 14:00
queryset.annotate(grouping_hours_integer=Seconds(F('violation_time')) % 7200).group_by('grouping_hours_integer')
Are you using postgres @Dragonwarrior47 ???
Luke-VideoLibre
@LukeVideo
Jul 10 2017 14:01
Like if i had a list of users, with the DjangoRestFrameWork i can get a list of username and location or whatever in the model. How would i call a weather API from to get the current weather of the location of a user? Would that be in the serializer? the model? a view???
Anish Shrestha
@annshress
Jul 10 2017 14:03

@Dragonwarrior47 https://stackoverflow.com/questions/34538770/django-queryset-annotate-with-datetime-calculations
You could do something like I wrote above.

If you are not using postgres, then you can look at the docs of https://github.com/hypertrack/django-pg-utils/blob/master/pg_utils/utils.py

And maybe build your Seconds Funcexpression
Kanhaiya Lal
@Dragonwarrior47
Jul 10 2017 14:09
@annshress I am using postgress
Anish Shrestha
@annshress
Jul 10 2017 14:10
So maybe you can use the above code. Not sure it works though. Try it out.
Ian Carpenter
@Sazpaimon
Jul 10 2017 19:07
In Django 1.8, what would be the best way to generate a ChoiceField where each choice has a custom HTML attribute with a unique value?
LuffyKing
@LuffyKing
Jul 10 2017 20:12
What's the best way to implement dynamic pick lists
Costantin
@Cosbgn
Jul 10 2017 22:23

@Cosbgn
Hi everyone, I'm having trouble setting up cron jobs on aws beanstalk, my jobs can also run just visiting a url, for example mysite.com/backup will start the backup (however resulting in a timeout error).

I'm wondering if it would be the same to use a third party service which just sends a post request every night at an X hour to mysite.com/backup (I could use for example ifttt.com)
this would avoid me setting up cron jobs
would the result be the same? Is this really that bad as a solution? If so why? (apart of being dependant on ifttt)
[This is for an early stage project, if things grow well of course I'll move to a "real" good solution, but in theory it should work just fine no?