Define the division value in model.py
and reflect it on the html page that displays the history list.
Give the History
table a partition value of STATUS
.
Point: choices =
manage.py
class History(models.Model):
STATUS = (
('001', 'Before implementation'), # BEFORE_EXECUTE
('011', 'Login'), # DURING_LOGIN
('012', 'Acquiring'), # WHILE_GETTING
('101', 'Done'), # DONE
('401', 'Failure') # fail
)
start_at = models.DateTimeField()
status = models.CharField(max_length=3, choices=STATUS)
Define the URL to the page that displays the list of history.
url.py
urlpatterns = [
#list
path('history_list', views.HistoryListView.as_view(), name='history_list'),
]
Define View to be passed to html of the page that displays the history list.
class HistoryListView(ListView):
model = History
template_name = 'history_list.html'
Point: get_FIELD_diaplay
example.html
<td>
{{ history.get_status_display }}
</td>
Recommended Posts