Re: find difference of dates between today and filter list[dates]

2018-07-26 Thread Deepak Madan Singh
Great help; Thanks Derek

On Thu, Jul 26, 2018 at 8:30 PM, Derek  wrote:

> Here's a created list of dates (before and after today) and a way to
> calculate the offset days relative to today ("now") and alert at a set
> interval:
>
> from __future__ import print_function
> import datetime
>
> now = datetime.datetime.now()
> dates = []
> for d in range(7, 0, -1):
> dates.append(datetime.datetime.now() - datetime.timedelta(days=d))
> for d in range(1, 8):
> dates.append(datetime.datetime.now() + datetime.timedelta(days=d))
> for _date in dates:
> diff = _date - now
> print(_date.strftime('%Y%m%d'), diff.days)
> if diff.days == 3:
> print('Alert @ 3 days!')
>
>
> On Wednesday, 25 July 2018 21:12:54 UTC+2, deepak madan wrote:
>>
>> HOW to find the difference between a list of dates and today and find the
>> difference matches some days difference. Help
>>
> --
> 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+unsubscr...@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/146e56b9-31b6-4fa4-9c08-4947dd75a087%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/146e56b9-31b6-4fa4-9c08-4947dd75a087%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> 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+unsubscr...@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/CAMwf7ZD1%3D--%2BwLeHhJ%2Bt8f8X7LA84xHfo9RRB%3D7CdR_5ZPESAw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: how to find activities dues for today and tommorow

2018-07-26 Thread Deepak Madan Singh
Thank you Julio :)

On Thu, Jul 26, 2018 at 12:53 AM, Julio Biason 
wrote:

> Hi Deepak,
>
> You could set up another model to track when something should be done to
> the tree; something like this:
>
> class Tree(models.Model):
> ...
> planted_date = models.DateField()
>
> class Reminder(models.Model):
> tree = models.ForeignKey(tree)
> when = models.DateField()
> what = models.CharField()
> done = models.BooleanField()
>
> So, when you create a tree, you get the current date and create the
> entries on the Reminder model. Somewhere, you can get the list of reminders
> with something like
>
> to_do = Reminder.object.filter(Q(tree=tree_in_view) &
> Q(when_lte=datetime.datetime.today()) & Q(done_ne=True))
>
> And throw this in the view -- it basically says "give me all the reminders
> for the tree I'm looking at in this point (say, you have a page for each
> tree, so this is the tree id), in which the reminder is from a date equal
> or before today (in case you don't want to show reminders for dates in the
> future) and which are not done (which you should also provide a way so the
> user can mark the reminder as "done" and not be bothered with it again).
>
> You can find more information about the Q here:
> https://docs.djangoproject.com/en/2.0/topics/db/queries/#
> complex-lookups-with-q-objects
>
> On Wed, Jul 25, 2018 at 3:07 PM, deepak madan 
> wrote:
>
>> suppose a model for the tree which is planted on some days. The second
>> model has activities dues to be done after some regular interval like 1)
>> giving fertilizer A after 5 days 2) giving fertilizer B after 15 days.
>> My question is when this 5th or 15th days arrives, to design a reminder
>> page to show activities dues today and tomorrow.
>>
>> Please help
>> Whats logic in views.py
>>
>> --
>> 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+unsubscr...@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/ms
>> gid/django-users/dab4e417-4f94-4712-83d9-8c447bafc922%40googlegroups.com
>> <https://groups.google.com/d/msgid/django-users/dab4e417-4f94-4712-83d9-8c447bafc922%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> *Julio Biason*, Sofware Engineer
> *AZION*  |  Deliver. Accelerate. Protect.
> Office: +55 51 3083 8101   |  Mobile: +55 51
> *99907 0554*
>
> --
> 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+unsubscr...@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/CAEM7gE2TpCpVB8MKb6Yu_uiKSpNc%3DZRxYk5vs-q6aKaG-c8zZA%
> 40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAEM7gE2TpCpVB8MKb6Yu_uiKSpNc%3DZRxYk5vs-q6aKaG-c8zZA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> 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+unsubscr...@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/CAMwf7ZAJhp2xgKmVs2%2BFbveYmLfAa6FDQedG3mrXhej-%3D2g6vw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


find difference of dates between today and filter list[dates]

2018-07-25 Thread deepak madan
HOW to find the difference between a list of dates and today and find the 
difference matches some days difference. Help 

-- 
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+unsubscr...@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/9be3eabd-8309-4088-ac57-e3bbb731a839%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


how to find activities dues for today and tommorow

2018-07-25 Thread deepak madan
suppose a model for the tree which is planted on some days. The second 
model has activities dues to be done after some regular interval like 1) 
giving fertilizer A after 5 days 2) giving fertilizer B after 15 days.
My question is when this 5th or 15th days arrives, to design a reminder 
page to show activities dues today and tomorrow.

Please help
Whats logic in views.py

-- 
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+unsubscr...@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/dab4e417-4f94-4712-83d9-8c447bafc922%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.