Skip to content
This repository was archived by the owner on Nov 3, 2019. It is now read-only.

Commit d9cbf2e

Browse files
authored
Merge pull request #1 from GAGANsinghmsitece/master
Creating django app and models
2 parents 7f4802f + 3e9f9b4 commit d9cbf2e

File tree

8 files changed

+75
-0
lines changed

8 files changed

+75
-0
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# cc_backend
22

3+
### Introduction
4+
CC_backend is back-end part of the "CodeClassRoom" project whose front-end will be based on REACT.This backend is built by [Gagan Singh](https://github.com/GAGANsinghmsitece) and
5+
[Bhupesh](https://github.com/Bhupesh-V).
6+
7+
38
### Prerequisties
49
- Python 3.6.8+
510
- virtualenv

codeclassroom/__init__.py

Whitespace-only changes.

codeclassroom/admin.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.contrib import admin
2+
3+
# Register your models here.

codeclassroom/apps.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from django.apps import AppConfig
2+
3+
4+
class CodeclassroomConfig(AppConfig):
5+
name = 'codeclassroom'

codeclassroom/migrations/__init__.py

Whitespace-only changes.

codeclassroom/models.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
from django.db import models
2+
from django.contrib.auth.models import User
3+
4+
'''From signup api endpoint we are expecting json response be like
5+
{'user':'Gagansingh','password':#########,'choice':'Student/Professor'}
6+
depending on choice we will create their student or prof model'''
7+
8+
9+
class Student(models.Model):
10+
user=models.OneToOneField(User,on_delete=models.CASCADE)
11+
name=models.CharField(max_length=100,blank=True)
12+
ProfilePic=models.ImageField(upload_to='StudentProfilePic',blank=True)
13+
College_Name=models.CharField(max_length=200,blank=True)
14+
Course=models.CharField(max_length=50,blank=True)
15+
16+
class Professor(models.Model):
17+
user=models.OneToOneField(User,on_delete=models.CASCADE)
18+
name=models.CharField(max_length=100,blank=True)
19+
ProfilePic=models.ImageField(upload_to='ProfessorProfilePic',blank=True)
20+
College_Name=models.CharField(max_length=200,blank=True)
21+
22+
'''I'm assuming a professor can create multiple classrooms and each classroom can have
23+
multiple classroom. if a classroom is deleted, all of the assignments of that class will
24+
delete automatically'''
25+
26+
class ClassRoom(models.Model):
27+
professor=models.ForeignKey(Professor,on_delete=models.CASCADE)
28+
title=models.CharField(max_length=200,blank=False)
29+
Picture=models.ImageField(upload_to='ClassMedia',blank=False)
30+
student=models.ManyToManyField(Student,blank=True)
31+
#because a student can join multiple classroom and each classroom can have multiple
32+
#students.For more info, refer to official docs
33+
34+
35+
class Assignments(models.Model):
36+
classroom=models.ForeignKey(ClassRoom,on_delete=models.CASCADE)
37+
title=models.CharField(max_length=200,blank=False)
38+
39+
class Questions(models.Model):
40+
assignment=models.ForeignKey(codeclassroom,on_delete=models.CASCADE)
41+
content=models.CharField(max_length=2000,blank=False)
42+
43+
'''NOW i will be making a reponse model ,i.e., response of a student for a assignment
44+
45+
'''
46+
class Respopnse(models.Model):
47+
question=models.ForeignKey(Questions,on_delete=models.CASCADE)
48+
student=models.ForeignKey(Student,on_delete=models.CASCADE)
49+
answer=models.CharField(max_length=40000,blank=False)
50+
remark=models.CharField(max_length=500,blank=True)#this field may be filled by prof
51+
#as remark
52+
53+
### this project is built by "codeclassroom" organisation and all rights are thereby
54+
#reserved.Please ask before copying this code or project
55+
# happy coding!!!
56+

codeclassroom/tests.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.test import TestCase
2+
3+
# Create your tests here.

codeclassroom/views.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from django.shortcuts import render
2+
3+
# Create your views here.

0 commit comments

Comments
 (0)