django forms自带form表单

from django import forms

from app_name import models

class class_name(forms.ModelForm)

  class Meta:

    model = models.Book //默认是所有的都匹配

    fields = ('name','pub_date') //提供要匹配的字段

    widget = {

      ‘name’:forms.TextInput(attrs = {'class':'form-control'}) 前端样式

    

posted on 2017-09-24 10:14  run_qin  阅读(134)  评论(0编辑  收藏  举报

导航