Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2014
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.33 KB | None | 0 0
  1. from django.db import models
  2. from django.contrib.auth.models import User
  3.  
  4. COURSE_TYPES = (('Technical', 'Technical'), ('Music', 'Music'), ('Food', 'Food'))
  5.  
  6. #Course
  7. class Course(models.Model):
  8.     """ To store all the courses list """
  9.     name = models.CharField(max_length = 50)
  10.     description = models.CharField(max_length = 200)
  11.     course_type = models.CharField(max_length = 20, choices = COURSE_TYPES)
  12.  
  13.     class Meta:
  14.         unique_together = ('name', 'course_type')
  15.  
  16.     def __unicode__(self):
  17.         return '%s: %s' % (self.name, self.course_type)
  18.  
  19.  
  20. #Student
  21. class Student(models.Model):
  22.     """ To store information about Student """
  23.     user = models.ForeignKey(User, related_name = 'user', null = True)
  24.     about = models.CharField(max_length = 200, null = True, default = "")
  25.     profile_pic = models.URLField(max_length = 300, null = True)
  26.     cover_pic = models.URLField(max_length = 300, null = True)
  27.     followers = models.IntegerField(default = 0)
  28.     following = models.IntegerField(default = 0)
  29.     city = models.CharField(max_length = 50)
  30.     state = models.CharField(max_length = 50)
  31.     street = models.CharField(max_length = 50)
  32.     mobile_no = models.IntegerField(max_length = 20)
  33.     mobile_no_verified = models.BooleanField(default = False)
  34.     courses_completed = models.IntegerField(default = 0)
  35.     courses = models.ForeignKey(Course, related_name = 'courses')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement