創建從形狀的模型我有一個前端的Django項目使用引導其具有約20場創建:在Django
<form id="form" class="form-vertical" action="/contact/" method="post">
{% csrf_token %}
<div class="container-fluid">
<div class="row">
<div class="col-md-6 col-sm-6 col-xs-12">
<form method="post">
<div class="form-group ">
<label class="control-label requiredField" for="subject">
Your Name (Primary Contact)
<span class="asteriskField">
*
</span>
</label>
<input class="form-control" id="subject" name="contact_name" type="text"/>
</div>
<div class="form-group ">
<label class="control-label requiredField" for="name">
Your Address (Primary Contact)
<span class="asteriskField">
*
</span>
在我的應用程序/ views.py我有:
def contact(request):
django_query_dict = request.POST
message = django_query_dict.dict()
回想起來,我可能應該使用模型表格(https://docs.djangoproject.com/en/dev/topics/forms/modelforms/#django.forms.ModelForm)。但鑑於我沒有,將數據清理並加載到db表中的最簡單方法是什麼?
...創建模型? –