Created
July 14, 2012 08:22
-
-
Save tuldok89/3110035 to your computer and use it in GitHub Desktop.
Model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
from django.contrib import admin | |
# Create your models here. | |
class Curriculum(models.Model): | |
CurriculumName = models.CharField(max_length=50) | |
NumYears = models.IntegerField() | |
class CurriculumAdmin(admin.ModelAdmin): | |
list_display = ('CurriculumName',) | |
class Student(models.Model): | |
IdNumber = models.CharField(max_length=10,primary_key=True) | |
LastName = models.CharField(max_length=50) | |
FirstName = models.CharField(max_length=50) | |
MiddleName = models.CharField(max_length=50) | |
Address = models.TextField() | |
Guardian = models.CharField(max_length=50) | |
Curriculum = models.ForeignKey(Curriculum) | |
class StudentAdmin(admin.ModelAdmin): | |
list_display = ('IdNumber', 'LastName', 'FirstName', 'MiddleName') | |
class YearLevels(models.Model): | |
Curriculum = models.ForeignKey(Curriculum) | |
YearNumber = models.IntegerField() | |
class YearLevelsAdmin(admin.ModelAdmin): | |
list_display = ('Curriculum', 'YearNumber') | |
class Section(models.Model): | |
SectionName = models.CharField(max_length=50) | |
YearLevel = models.ForeignKey(YearLevels) | |
class SectionAdmin(admin.ModelAdmin): | |
list_display = ('SectionName', 'YearLevel') | |
admin.site.register(Curriculum, CurriculumAdmin) | |
admin.site.register(Student, StudentAdmin) | |
admin.site.register(YearLevels, YearLevelsAdmin) | |
admin.site.register(Section, SectionAdmin) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment