Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from django.db import models
- from django.contrib.auth.models import User
- COURSE_TYPES = (('Technical', 'Technical'), ('Music', 'Music'), ('Food', 'Food'))
- #Course
- class Course(models.Model):
- """ To store all the courses list """
- name = models.CharField(max_length = 50)
- description = models.CharField(max_length = 200)
- course_type = models.CharField(max_length = 20, choices = COURSE_TYPES)
- class Meta:
- unique_together = ('name', 'course_type')
- def __unicode__(self):
- return '%s: %s' % (self.name, self.course_type)
- #Student
- class Student(models.Model):
- """ To store information about Student """
- user = models.ForeignKey(User, related_name = 'user', null = True)
- about = models.CharField(max_length = 200, null = True, default = "")
- profile_pic = models.URLField(max_length = 300, null = True)
- cover_pic = models.URLField(max_length = 300, null = True)
- followers = models.IntegerField(default = 0)
- following = models.IntegerField(default = 0)
- city = models.CharField(max_length = 50)
- state = models.CharField(max_length = 50)
- street = models.CharField(max_length = 50)
- mobile_no = models.IntegerField(max_length = 20)
- mobile_no_verified = models.BooleanField(default = False)
- courses_completed = models.IntegerField(default = 0)
- courses = models.ForeignKey(Course, related_name = 'courses')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement