# Path: data_center/models.py
# class Announcement(models.Model):
#     TAG_CHOICE = (
#         ('Info', '公告'),
#         ('Bug', '已知問題'),
#         ('Fix', '問題修復'),
#     )
# 
#     content = models.TextField(blank=True)
#     time = models.DateTimeField(default=datetime.now)
#     tag = models.CharField(max_length=10, choices=TAG_CHOICE, default='Info')
# 
#     def __str__(self):
#         return '%s|%s' % (self.time, self.tag)


from django.shortcuts import render
from data_center.models import Announcement



def index(request):
    announcements = Announcement.objects.all().order_by('-time')
    return render(request, 'index/index.html',

# Path: data_center/models.py
# class Announcement(models.Model):
#     TAG_CHOICE = (
#         ('Info', '公告'),
#         ('Bug', '已知問題'),
#         ('Fix', '問題修復'),
#     )
# 
#     content = models.TextField(blank=True)
#     time = models.DateTimeField(default=datetime.now)
#     tag = models.CharField(max_length=10, choices=TAG_CHOICE, default='Info')
# 
#     def __str__(self):
#         return '%s|%s' % (self.time, self.tag)


# Path: index/views.py
from django.shortcuts import render
from data_center.models import Announcement




def index(request):
    announcements = Announcement.objects.all().order_by('-time')
    return render(request, 'index/index.html',

                  {'announcements': announcements})