一种形式的共享数据分成多行

时间:2015-02-06 08:56:40

标签: python mysql django django-forms

我正在寻找有关如何将大型调查保存到多行(MySQL)的想法。任何帮助将不胜感激。我对python和django编程比较陌生。

形式:

<form method="post">

<label for="InputOD1" class="col-sm-2 control-label">Order Number</label>
<input type="text" id="InputOD1" name="InputOD1" placeholder="Order Number">

<label for="InputSA1" class="col-sm-2 control-label">Shipping Address</label>
<input type="text" id="InputSA1" name="InputSA1" placeholder="Shipping Address">



<label for="InputFN1" class="col-sm-2 control-label">First Name</label>
<input type="text" id="InputFN1" name="InputFN1" placeholder="Last Name">

<label for="InputLN1" class="col-sm-2 control-label">Last Name</label>
<input type="text" id="InputLN1" name="InputLN1" placeholder="Last Name">

<label for="InputGR1" class="col-sm-2 control-label">Gender</label>
<input type="text" id="InputGR1" name="InputGR1" placeholder="Gender>



<label for="InputFN2" class="col-sm-2 control-label">First Name</label>
<input type="text" id="InputFN2" name="InputFN2" placeholder="Last Name">

<label for="InputLN1" class="col-sm-2 control-label">Last Name</label>
<input type="text" id="InputLN2" name="InputLN2" placeholder="Last Name">

<label for="InputGR1" class="col-sm-2 control-label">Gender</label>
<input type="text" id="InputGR2" name="InputGR2" placeholder="Gender>

<button type="submit" class="btn btn-default">Submit</button>

</form>

预期的数据库结果:

Order Number, Shipping Address, First Name 1, Last Name 1, Gender 1
Order Number, Shipping Address, First Name 2, Last Name 2, Gender 2
....
Order Number, Shipping Address, First Name 5, Last Name 5, Gender 5

1 个答案:

答案 0 :(得分:0)

对于此任务,您应使用django formsets