CSS – Integrate HTML form with model in Dengue for data collection

  • Home / Blog / CSS – Integrate…

CSS – Integrate HTML form with model in Dengue for data collection

I wanted to know how to combine the HTML form below with a specific model. Also, in order to collect data, how can I combine multiple forms from multiple models (or tables in a database) to multiple forms?

<form action='register' method="POST" >
                {% csrf_token %}
             
                <table>
                    <tr>
                        <td><label for="name">NAME :</label></td>
                        <td><input type="text" id="first_name" name="name" maxlength="50" ></td>
                    </tr>
                    <tr>
                        <td><label for="email">EMAIL :</label></td>
                        <td><input type="email" id="email" name="email"  placeholder="This will be your User ID"></td>
                    </tr>
                   
                    <tr>
                        <td><label for="phone">MOBILE NUMBER :</label></td>
                        <td><input type="tel" id="phone" name="phone" maxlength="10" pattern="[0-9]{10}" oninput="this.value = this.value.replace(/[^0-9.]/g, '').replace(/(..*)./g, '$1');" ></td>
                    </tr>
                          
                     <tr>
                        <td><label for="join_as">JOIN AS :</label></td>
                        <td><select id="join_as" name="join_as" >
                            <option value="select" disabled selected hidden>Select...</option>
                            <option value="individual" >INDIVIDUAL</option>
                            <option value="firm" >FIRM</option>
                            <option value="company" >COMPANY</option>
                            <option value="consultancy">CONSULTANCY</option>
                            <option value="students" >STUDENTS</option>
                            <option value="others" >OTHERS</option>
                        </td>
                        </select>
                    </tr>
                    <tr>
                        <td><label for="passpwrd">PASSWORD:</label></td>
                        <td><input type="password" id="password" name="password" maxlength="10" placeholder="max 10 characters" ></td>
                    </tr>
                    <tr>
                        <td><label for="con_passpwrd">CONFIRM PASSWORD :</label></td>
                        <td><input type="password" id="con_password" name="con_password" maxlength="10" ></td>
                    </tr>
                </table>

</form>
    class Regd3(models.Model):
    name= models.CharField(max_length=100)
    username= models.EmailField(max_length=254, primary_key= True)  #email
    mobile_number= models.CharField(max_length=10)
    category = models.CharField(max_length=10)
    password= models.CharField(max_length=10)
    agreed= models.BooleanField(default=False)

What should i write

Write a Comment

Your email address will not be published. Required fields are marked *

x