Skip to content

Commit 4cefd58

Browse files
committed
added admin and models
1 parent f3dd0a7 commit 4cefd58

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
from django.contrib import admin
2-
2+
from .models import School,Student
33
# Register your models here.
4+
admin.site.register(School)
5+
admin.site.register(Student)
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
11
from django.db import models
2+
from django.urls import reverse
3+
# SuperUserInformation
4+
# User: Jose
5+
# Email: training@pieriandata.com
6+
# Password: testpassword
27

38
# Create your models here.
9+
class School(models.Model):
10+
name = models.CharField(max_length=256)
11+
principal = models.CharField(max_length=256)
12+
location = models.CharField(max_length=256)
13+
14+
def __str__(self):
15+
return self.name
16+
17+
class Student(models.Model):
18+
name = models.CharField(max_length=256)
19+
age = models.PositiveIntegerField()
20+
school = models.ForeignKey(School,related_name='students',on_delete=models.CASCADE)
21+
22+
def __str__(self):
23+
return self.name

0 commit comments

Comments
 (0)