nikhilrayaprolu / SocialBack

Django Application for social Wall
0 stars 0 forks source link

Initiate a Django Application and add all models listed in the UML #1

Open nikhilrayaprolu opened 5 years ago

nikhilrayaprolu commented 5 years ago

image

class School(models.Model):
    organization = models.OneToOneField(Organization, related_name='school_profile')
    schoolname = models.CharField(max_length=50, blank=True, null=True)
    principal = models.CharField(max_length=30, blank=True, null=True)
    email = models.EmailField(blank=True, null=True)
    contact_number = models.CharField(max_length=20, blank=True, null=True)
    address = models.TextField(blank=True, null=True)
    website = models.CharField(max_length=20, blank=True, null=True)
    board = models.CharField(max_length=20, blank=True, null=True)
    schoollogo = models.ImageField(blank=True, upload_to='school_logo', default='school_logo/no-image.jpg')

class Class(models.Model):
    organization = models.ForeignKey(Organization)
    class_level = models.CharField(max_length=5)
    display_name = models.CharField(max_length=10)
    num_sections = models.IntegerField(default=0)

class Section(models.Model):
    section_class = models.ForeignKey(Class)
    section_name = models.CharField(max_length=5)
    description = models.CharField(max_length=144, blank=True, null=True)

class Course(models.Model):
    organization = models.ForeignKey(Organization)
    course_class = models.ForeignKey(Class)
    course_section = models.ForeignKey(Section)
    course_name = models.CharField(max_length=50)
    description = models.CharField(max_length=144, blank=True, null=True)
    year = models.IntegerField(default=2020)
    courseno = models.CharField(max_length=50)
    courserun = models.CharField(max_length=30)
    course_id = models.CharField(max_length=80)
    course_status = models.CharField(max_length=3)

class UserMiniProfile(models.Model):
    user = models.ForeignKey(User)
    first_name = models.CharField(max_length=40, blank=True, null=True)
    last_name = models.CharField(max_length=40, blank=True, null=True)
    gender = models.CharField(max_length=1, blank=True, null=True)
    email = models.CharField(max_length=40, blank=True, null=True)
    contact_number = models.CharField(max_length=40, blank=True, null=True)
    birthday = models.DateField(blank=True, null=True)
    is_staff = models.BooleanField(blank=True)
    school = models.ForeignKey(School,blank = True,null=True)

class UserSectionMapping(models.Model):
    user = models.ForeignKey(User)
    section = models.ForeignKey(Section)

The above part of the code can be useful.