0

Does someone know how to style this form with bootstrap?

from django.forms import ModelForm
from .models import *
from django import forms

class OrderForm(ModelForm):


    class Meta:
        model = Order
        fields = ('__all__')

** ^ forms.py ^**

class Order(models.Model):


customer = models.ForeignKey(Customer, null=True, on_delete= models.SET_NULL)
product = models.ForeignKey(Product, null=True, on_delete= models.SET_NULL)
date_created = models.DateTimeField(auto_now_add=True, null=True)
status = models.CharField(max_length=200, null=True, choices=STATUS)

def __str__(self):
    return self.product.name

This is the model where the form is about

{%  extends 'accounts/main.html' %}
{% load static %}

{% block content %}

    <div class="row mt-4">
        <div class="col-md-6">
            <div class="card card-body text-center border border-info">
                <form action="" method="POST">
                    {% csrf_token %}
                    {{form}}
                    <input type="submit" name="submit">
                </form>

            </div>
        </div>
</div>

{% endblock %}

^This is My html template^

I have tried different types of methods but i can't find how to style the form.

My BootstrapCDN stands in the main.html page

Droezel
  • 1
  • 1
  • 1
    Does this answer your question? [Django Forms and Bootstrap - CSS classes and ](https://stackoverflow.com/questions/8474409/django-forms-and-bootstrap-css-classes-and-divs) – MohitC Apr 24 '20 at 21:12
  • Thank you for the help, the page was very helpful, I found a few things on that page that where very uselfull. After some further research i found the specific answer on this page: https://stackoverflow.com/questions/31627253/django-modelform-with-bootstrap Thank you for the help – Droezel Apr 25 '20 at 11:04

0 Answers0