Initialise bulletin date to next Sunday
This commit is contained in:
parent
04093baf47
commit
07c141d509
@ -93,7 +93,8 @@ def bulletin_new(request):
|
|||||||
return redirect(reverse('bulletin_edit', kwargs={'id': item.id}))
|
return redirect(reverse('bulletin_edit', kwargs={'id': item.id}))
|
||||||
else:
|
else:
|
||||||
item = models.BulletinItem()
|
item = models.BulletinItem()
|
||||||
item.date = timezone.now()
|
item.date = timezone.now().date()
|
||||||
|
item.date += datetime.timedelta(days=(6 - item.date.weekday() + 7) % 7) # Next Sunday (6 = Sunday)
|
||||||
return render(request, 'sspromotions/bulletin_edit.html', {
|
return render(request, 'sspromotions/bulletin_edit.html', {
|
||||||
'item': item,
|
'item': item,
|
||||||
'groups': [group for group in models.Group.objects.all() if group.can_user_access(request.user)],
|
'groups': [group for group in models.Group.objects.all() if group.can_user_access(request.user)],
|
||||||
|
Loading…
Reference in New Issue
Block a user