Django將從數據庫中獲取到數據轉換爲dict

這種方式只能應用於從數據庫中獲取到的單條數據,例如models.Users.objects.get()獲取到的數據python from django.forms.models import model_to_dict class Index(VIew): def get(self, request): userObj = models.Users.objects.get(id = 1)
相關文章
相關標籤/搜索