filmov
tv
Django Project 8 Inserting data into database from HTML page
Показать описание
----------------------------------------
Welcome to Official Tech
---------------------------------------
Django Project 8 Inserting data into database from HTML page
Here we will create a DB
and HTML page
and GETTING data from that HTML page
and Inserting into DB
-----------
from app8 import views
urlpatterns = [
]
---------------------------------------------------------------------------------------------------
-------------
from .models import StudentDetails
# Create your views here.
def indexpage(req):
def newPage(request):
id = request.POST.get("idno1")
na = request.POST.get("name1")
co = request.POST.getlist("course1")
mark = request.POST.get("marks1")
cont = request.POST.get("contact1")
o_ref = StudentDetails(name=na, idno=id, course=co, contact=cont, marks=mark)
-----------------------------------------------------------------------------------------------------
-----------------
# Create your models here.
class StudentDetails(models.Model):
idno = models.IntegerField(primary_key=True)
name = models.CharField(max_length=33)
course = models.CharField(max_length=200)
marks = models.DecimalField(max_digits=10 , decimal_places=5)
contact = models.IntegerField()
for HTML page visit(youtube not allow HTML code):
Welcome to Official Tech
---------------------------------------
Django Project 8 Inserting data into database from HTML page
Here we will create a DB
and HTML page
and GETTING data from that HTML page
and Inserting into DB
-----------
from app8 import views
urlpatterns = [
]
---------------------------------------------------------------------------------------------------
-------------
from .models import StudentDetails
# Create your views here.
def indexpage(req):
def newPage(request):
id = request.POST.get("idno1")
na = request.POST.get("name1")
co = request.POST.getlist("course1")
mark = request.POST.get("marks1")
cont = request.POST.get("contact1")
o_ref = StudentDetails(name=na, idno=id, course=co, contact=cont, marks=mark)
-----------------------------------------------------------------------------------------------------
-----------------
# Create your models here.
class StudentDetails(models.Model):
idno = models.IntegerField(primary_key=True)
name = models.CharField(max_length=33)
course = models.CharField(max_length=200)
marks = models.DecimalField(max_digits=10 , decimal_places=5)
contact = models.IntegerField()
for HTML page visit(youtube not allow HTML code):
Комментарии