On Wednesday, April 19, 2017 at 8:45:52 AM UTC-7, [email protected] wrote:
>
> that is correct. That is one per each time I restarted the app. It is
> only one per insert. it's an indention error? pray tell
>
> /dps
On Tuesday, April 18, 2017 at 12:13:32 PM UTC-7, Dave S wrote:
>
>
>>
>> On Tuesday, April 18, 2017 at 12:02:28 PM UTC-7, R U wrote:
>>>
>>> I am trying to insert many dates into a field. Currently I am only
>>> getting 1 date inserted.
>>> my overall goal is to insert many (semi random) dates into the database;
>>> each user will have his/her own unique list. Then later iterate over the
>>> list having the date trigger some event if it equals today's date.
>>>
>>> controller:
>>> from datetime import date, datetime, timedelta
>>> import random
>>> from random import randint
>>> dog = randint(3,25)
>>> def perdelta(start, end, delta):
>>> curr = start
>>> while curr < end:
>>> yield curr
>>> curr += delta
>>>
>>> for result in perdelta(date(2017, 11, 11), date(2018, 12, 12),
>>> timedelta(days=dog)):
>>> print str(result)
>>>
>>> fun.zipdip.insert(infom=result)
>>>
>>> model:
>>> fun = DAL('sqlite://storage.sqlite')
>>> fun.define_table('zipdip',
>>> Field('infom')),
>>>
>>> result in dal is:
>>> 3 selected
>>> zipdip.id
>>> <https://ledc.pythonanywhere.com/tim/appadmin/select/fun?orderby=zipdip.id>
>>> zipdip.infom
>>> <https://ledc.pythonanywhere.com/tim/appadmin/select/fun?orderby=zipdip.infom>
>>> 1 <https://ledc.pythonanywhere.com/tim/appadmin/update/fun/zipdip/1>
>>> 2018-11-30
>>> 2 <https://ledc.pythonanywhere.com/tim/appadmin/update/fun/zipdip/2>
>>> 2018-12-07
>>> 3 <https://ledc.pythonanywhere.com/tim/appadmin/update/fun/zipdip/3>
>>> 2018-11-30
>>>
>>>
>>
>> If your indentation is as shown above, I'm surprised you get 3, because
>> it looks like you're only inserting the last one.
>>
>> /dps
>>
>>
>>> but if the code is run for example in repl.it the result is the outcome
>>> I am looking for
>>>
>>> 2017-11-11
>>> 2017-11-24
>>> 2017-12-07
>>> 2017-12-20
>>> 2018-01-02
>>> 2018-01-15
>>> 2018-01-28
>>> 2018-02-10
>>> 2018-02-23
>>> 2018-03-08
>>> 2018-03-21
>>> 2018-04-03
>>> 2018-04-16
>>> 2018-04-29
>>> 2018-05-12
>>> 2018-05-25
>>> 2018-06-07
>>> 2018-06-20
>>> 2018-07-03
>>> 2018-07-16
>>> 2018-07-29
>>> 2018-08-11
>>> 2018-08-24
>>> 2018-09-06
>>> 2018-09-19
>>> 2018-10-02
>>> 2018-10-15
>>> 2018-10-28
>>> 2018-11-10
>>> 2018-11-23
>>> 2018-12-06
>>>
>>>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.