Re: models, peeking to next record - maybe

2015-02-07 Thread Vijay Khemlani
The direct solution would be something like this in your view events = Event.objects.order_by('event_date') event_tuples = [] last_date_seen = None for event in events: if last_date_seen: date_difference = event.date - last_date_seen else: date_difference = None

Re: models, peeking to next record - maybe

2015-02-07 Thread Lachlan Musicman
My initial suggestion would be to utilise the "order by" option, and order by date. Then, on each model have a find_next function and a until_next function. The first would work out which was the next event, the other the time. They could be coupled, but keeping them separate means you can

models, peeking to next record - maybe

2015-02-07 Thread Richard Bowden
Got an problem that I am struggling to solve.. I have: class Address(models.Model): name = models.CharField() event_date = models.DateTime() event1, 25/01/2015 event2, 27/01/2015 event3, 05/02/2015 and so on… what I am trying to figure out is, how to calculate the days between each event.

models, peeking to next record - maybe

2015-02-07 Thread Richard Bowden
I am working on a problem that I am trying to figure out, not having much luck so far... I have a model, basic for this example: class Event(models.Model): name = models.Charfield(max_length=10) event_date = models.DateTime() I am trying to workout how I can calculate the number of days

Re: how to access json data value(s) returned back to django view from 'GET' request to an api

2015-02-07 Thread Henry Versemann
Scot, Thanks for the response. I will try it first thing Monday morning. If I have any other questions I may post them then, but this should get most of it for me. Thanks again. Henry On Saturday, February 7, 2015 at 1:35:39 AM UTC-6, Scot Hacker wrote: > > On Friday, February 6, 2015 at

Re: how to access json data value(s) returned back to django view from 'GET' request to an api

2015-02-07 Thread JSON CSV
On Friday, February 6, 2015 at 5:10:32 AM UTC+10, Henry Versemann wrote: > > I have a django view (django v. 1.7 ; python v. 2.7.8) which currently and > successfully sends a request to an api, and receives a good response back. > I'm sending and receiving using the 'requests' library (v.

Re: amazon s3 and django - Allow only the users from my website and not the anonymous users

2015-02-07 Thread Kakar Nyori
Hello, thank you for the response. Could you please give an example as to how to do that above mentioned? Thank you. On Friday, February 6, 2015 at 11:10:50 PM UTC+5:30, Nikolas Stevenson-Molnar wrote: > > It sounds like you want to use signed URLs. Since you're using storages, > this should

Re: Login in all pages

2015-02-07 Thread Scot Hacker
On Thursday, February 5, 2015 at 5:35:09 AM UTC-8, Juan Diego Gonzalez wrote: > > Hi, I need to put the django login feature in all pages, I mean, the user > will be able to login in the reserved area of the web from any public page. > > Install django-stronghold or similar.