From 59cd3a0045d7dd296b501f365b096dbb763b0efe Mon Sep 17 00:00:00 2001 From: gagansinghmsitece Date: Tue, 2 Jul 2019 09:15:44 +0530 Subject: [PATCH 1/4] Create app and models while updating readme --- README.md | 5 +++ codeclassroom/__init__.py | 0 codeclassroom/admin.py | 3 ++ codeclassroom/apps.py | 5 +++ codeclassroom/migrations/__init__.py | 0 codeclassroom/models.py | 56 ++++++++++++++++++++++++++++ codeclassroom/tests.py | 3 ++ codeclassroom/views.py | 3 ++ 8 files changed, 75 insertions(+) create mode 100644 codeclassroom/__init__.py create mode 100644 codeclassroom/admin.py create mode 100644 codeclassroom/apps.py create mode 100644 codeclassroom/migrations/__init__.py create mode 100644 codeclassroom/models.py create mode 100644 codeclassroom/tests.py create mode 100644 codeclassroom/views.py diff --git a/README.md b/README.md index f9050ff..9fb6cc9 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,10 @@ # cc_backend +#Introduction +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 +[https://github.com/Bhupesh-V]. + + ### Prerequisties - Python 3.6.8+ - virtualenv diff --git a/codeclassroom/__init__.py b/codeclassroom/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/codeclassroom/admin.py b/codeclassroom/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/codeclassroom/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/codeclassroom/apps.py b/codeclassroom/apps.py new file mode 100644 index 0000000..c157cf1 --- /dev/null +++ b/codeclassroom/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class CodeclassroomConfig(AppConfig): + name = 'codeclassroom' diff --git a/codeclassroom/migrations/__init__.py b/codeclassroom/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/codeclassroom/models.py b/codeclassroom/models.py new file mode 100644 index 0000000..0e2551a --- /dev/null +++ b/codeclassroom/models.py @@ -0,0 +1,56 @@ +from django.db import models +from django.contrib.auth.models import User + +'''From signup api endpoint we are expecting json response be like + {'user':'Gagansingh','password':#########,'choice':'Student/Professor'} + depending on choice we will create their student or prof model''' + + +class Student(models.Model): + user=models.OneToOneField(User,on_delete=models.CASCADE) + name=models.CharField(max_length=100,blank=True) + ProfilePic=models.ImageField(upload_to='StudentProfilePic',blank=True) + College_Name=models.CharField(max_length=200,blank=True) + Course=models.CharField(max_length=50,blank=True) + +class Professor(models.Model): + user=models.OneToOneField(User,on_delete=models.CASCADE) + name=models.CharField(max_length=100,blank=True) + ProfilePic=models.ImageField(upload_to='ProfessorProfilePic',blank=True) + College_Name=models.CharField(max_length=200,blank=True) + +'''I'm assuming a professor can create multiple classrooms and each classroom can have +multiple classroom. if a classroom is deleted, all of the assignments of that class will +delete automatically''' + +class ClassRoom(models.Model): + professor=models.ForeignKey(Professor,on_delete=models.CASCADE) + title=models.CharField(max_length=200,blank=False) + Picture=models.ImageField(upload_to='ClassMedia',blank=False) + student=models.ManyToManyField(Student,blank=True) + #because a student can join multiple classroom and each classroom can have multiple + #students.For more info, refer to official docs + + +class Assignments(models.Model): + classroom=models.ForeignKey(ClassRoom,on_delete=models.CASCADE) + title=models.CharField(max_length=200,blank=False) + +class Questions(models.Model): + assignment=models.ForeignKey(codeclassroom,on_delete=models.CASCADE) + content=models.CharField(max_length=2000,blank=False) + +'''NOW i will be making a reponse model ,i.e., response of a student for a assignment + +''' +class Respopnse(models.Model): + question=models.ForeignKey(Questions,on_delete=models.CASCADE) + student=models.ForeignKey(Student,on_delete=models.CASCADE) + answer=models.CharField(max_length=40000,blank=False) + remark=models.CharField(max_length=500,blank=True)#this field may be filled by prof + #as remark + +### this project is built by "codeclassroom" organisation and all rights are thereby +#reserved.Please ask before copying this code or project +# happy coding!!! + diff --git a/codeclassroom/tests.py b/codeclassroom/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/codeclassroom/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/codeclassroom/views.py b/codeclassroom/views.py new file mode 100644 index 0000000..91ea44a --- /dev/null +++ b/codeclassroom/views.py @@ -0,0 +1,3 @@ +from django.shortcuts import render + +# Create your views here. From 96f0c9b43a1fa2c6146ed21b845a5f1d26f11543 Mon Sep 17 00:00:00 2001 From: gagansinghmsitece Date: Tue, 2 Jul 2019 09:19:22 +0530 Subject: [PATCH 2/4] updating readme.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9fb6cc9..6cf326b 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ #Introduction 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 -[https://github.com/Bhupesh-V]. +[Bhupesh](https://github.com/Bhupesh-V). ### Prerequisties From 72f99e43bfd38822e685bfd94c5c448ec9f2e43b Mon Sep 17 00:00:00 2001 From: gagansinghmsitece Date: Tue, 2 Jul 2019 09:21:10 +0530 Subject: [PATCH 3/4] updating readme.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6cf326b..1358af7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # cc_backend -#Introduction +###Introduction 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 [Bhupesh](https://github.com/Bhupesh-V). From 3e9f9b4001c0ea2a674a54a100153a355eb80b3e Mon Sep 17 00:00:00 2001 From: gagansinghmsitece Date: Tue, 2 Jul 2019 09:22:30 +0530 Subject: [PATCH 4/4] updating readme.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1358af7..ffa6430 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # cc_backend -###Introduction +### Introduction 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 [Bhupesh](https://github.com/Bhupesh-V).