You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

views.py 536B

1234567891011121314151617
  1. from django.http import HttpResponse
  2. from django.shortcuts import render
  3. import time
  4. from django.utils import timezone
  5. from datetime import timedelta
  6. from polls.models import Notice
  7. def index(request):
  8. context = {'now' : time.strftime('%H:%M:%S', time.localtime()),
  9. 'posts' : Notice.objects.all() }
  10. # start = timezone.now()
  11. #end = start + timedelta(days=10)
  12. #for n in Notice.objects.all():
  13. # print(n.notice_title)
  14. return render(request, 'polls/index.html', context)
  15. # Create your views here.