from django.db import models
class User(models.Model):
student_id = models.CharField(max_length=20, unique=True)
name = models.CharField(max_length=50)
password = models.CharField(max_length=100)
class Application(models.Model):
STUDENT_TYPES = [
('leave', 'Leave'),
('grade_query', 'Grade Query'),
]
user = models.ForeignKey(User, on_delete=models.CASCADE)
type = models.CharField(max_length=20, choices=STUDENT_TYPES)
status = models.CharField(max_length=20, default='pending')
created_at = models.DateTimeField(auto_now_add=True)
from django.views.generic import ListView
from .models import Application
class ApplicationListView(ListView):
model = Application
template_name = 'application_list.html'
本文通过对话形式介绍了如何利用Django框架开发一个大学网上流程平台,涵盖了数据库设计、后端开发及前端展示等内容,旨在提高校园管理效率。