Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- >class Event(models.Model):
- >somefield
- >somefield
- >reminder=models.IntegerField('Reminder', default=0, choices=REMINDER_STATUS)
- >reminderx = models.IntegerField('Days',blank=True, null=True)
- today = date.today()
- a = Event.objects.filter(del_f=0)
- is_today = []
- is_week=[]
- is_custom =[]
- for i in a:
- print('i:',i)
- reminder = i.reminder
- if reminder == 1 :
- rtoday = i.start_date.date() - timedelta(days=1)
- print('rtoday:',rtoday)
- if rtoday == today:
- is_today.append(i)
- if reminder == 2 :
- rweek = i.start_date.date() - timedelta(days=7)
- if rweek == today:
- is_week.append(i)
- if reminder == 3 :
- reminderx = i.reminderx
- rcustom = i.start_date.date() - datetime.timedelta(days= reminderx)
- if rcustom == today:
- is_custom.append(i)
- context['today'] = is_today
- context['week'] = is_week
- context['custom'] = is_custom
- return context
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement