Wednesday, October 28, 2020

Django models test

 Django models test...

======================

.in models.py file

class student(models.Model):

    student_sno = models.IntegerField();

    student_name = models.CharField(max_length=256);

    student_father_name= models.CharField(max_length=256);


class student_class(models.Model):

    student = models.ForeignKey(student,on_delete=models.CASCADE) 


python manage.py makemigrations your_app


python manage.py sqlmigrate your_app 0001


python manage.py migrate


python .\manage.py shell



in db shell

=====================

from chess2.models import student, student_class

No comments:

Post a Comment

python class topic video