# Path: data_center/models.py
# class FlatPrerequisite(models.Model):
#     '''
#     store rendered prerequisite in the database
#     alternative: django.contrib.flatpage
#     '''
#     updated_at = models.DateTimeField(auto_now=True)
#     html = models.TextField()
# 
#     @classmethod
#     def update_html(cls, html):
#         if cls.objects.exists():
#             ins = cls.objects.get()
#             ins.html = html
#             ins.save()
#             return ins
#         else:
#             return cls.objects.create(html=html)


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



def prerequisite(request):
    return render(
        request,
        'table/prerequisites.html',

# Path: data_center/models.py
# class FlatPrerequisite(models.Model):
#     '''
#     store rendered prerequisite in the database
#     alternative: django.contrib.flatpage
#     '''
#     updated_at = models.DateTimeField(auto_now=True)
#     html = models.TextField()
# 
#     @classmethod
#     def update_html(cls, html):
#         if cls.objects.exists():
#             ins = cls.objects.get()
#             ins.html = html
#             ins.save()
#             return ins
#         else:
#             return cls.objects.create(html=html)


# Path: table/views.py
from django.shortcuts import render
from data_center.models import FlatPrerequisite




def prerequisite(request):
    return render(
        request,
        'table/prerequisites.html',

        {'data': FlatPrerequisite.objects.get()}