Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CS699_COURSEBOOK
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
AMAN MORESHWAR JANGDE
CS699_COURSEBOOK
Commits
c9c97d64
Commit
c9c97d64
authored
Nov 06, 2019
by
AMAN MORESHWAR JANGDE
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Phase 1 demo
parent
e205f4ec
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
161 additions
and
174 deletions
+161
-174
coursebook/urls.py
coursebook/urls.py
+3
-7
discussion/admin.py
discussion/admin.py
+1
-2
discussion/forms.py
discussion/forms.py
+3
-7
discussion/migrations/0001_initial.py
discussion/migrations/0001_initial.py
+1
-14
discussion/models.py
discussion/models.py
+2
-8
discussion/static/css/login.css
discussion/static/css/login.css
+5
-1
discussion/static/css/signup.css
discussion/static/css/signup.css
+5
-1
discussion/static/img/logo.png
discussion/static/img/logo.png
+0
-0
discussion/templates/available_subjects.html
discussion/templates/available_subjects.html
+37
-0
discussion/templates/base.html
discussion/templates/base.html
+2
-1
discussion/templates/default.html
discussion/templates/default.html
+13
-31
discussion/templates/discussion_topics.html
discussion/templates/discussion_topics.html
+1
-1
discussion/templates/login.html
discussion/templates/login.html
+30
-24
discussion/templates/signup.html
discussion/templates/signup.html
+24
-21
discussion/templates/subjects.html
discussion/templates/subjects.html
+24
-21
discussion/views.py
discussion/views.py
+10
-35
djangodb
djangodb
+0
-0
No files found.
coursebook/urls.py
View file @
c9c97d64
...
...
@@ -25,15 +25,11 @@ from django.urls import path
from
discussion
import
views
urlpatterns
=
[
path
(
'admin/'
,
admin
.
site
.
urls
),
path
(
'emp'
,
views
.
emp
),
path
(
'show'
,
views
.
show
),
path
(
'edit/<int:id>'
,
views
.
edit
),
path
(
'update/<int:id>'
,
views
.
update
),
path
(
'delete/<int:id>'
,
views
.
destroy
),
path
(
''
,
views
.
default
),
path
(
'subjects/'
,
views
.
show_subjects
),
path
(
'topics/<int:id>'
,
views
.
show_topics
),
path
(
'available_subjects/'
,
views
.
show_all_subjects
),
path
(
'topics/<str:id>'
,
views
.
show_topics
),
path
(
'threads/<int:id>'
,
views
.
show_threads
),
path
(
'login'
,
views
.
login
),
path
(
'signup'
,
views
.
signup
),
...
...
discussion/admin.py
View file @
c9c97d64
from
django.contrib
import
admin
# Register your models here.
from
discussion.models
import
Employee
,
Person
,
Subject
,
Topic
,
Thread
,
Like
,
Subject_Student
from
discussion.models
import
Person
,
Subject
,
Topic
,
Thread
,
Like
,
Subject_Student
admin
.
site
.
register
(
Subject
)
admin
.
site
.
register
(
Employee
)
admin
.
site
.
register
(
Person
)
admin
.
site
.
register
(
Topic
)
admin
.
site
.
register
(
Thread
)
...
...
discussion/forms.py
View file @
c9c97d64
from
django
import
forms
from
discussion.models
import
Employee
,
Thread
,
Topic
,
Person
class
EmployeeForm
(
forms
.
ModelForm
):
class
Meta
:
model
=
Employee
fields
=
"__all__"
from
discussion.models
import
Thread
,
Topic
,
Person
class
ThreadForm
(
forms
.
ModelForm
):
msg
=
forms
.
CharField
(
widget
=
forms
.
Textarea
(
attrs
=
{
'class'
:
'form-control send-message'
,
'rows'
:
'3'
,
'placeholder'
:
'Comment...'
}))
...
...
@@ -24,7 +20,7 @@ class SignupForm(forms.ModelForm):
pid
=
forms
.
CharField
(
widget
=
forms
.
TextInput
(
attrs
=
{
'class'
:
'inp-field'
,
'placeholder'
:
'PID...'
}))
fname
=
forms
.
CharField
(
widget
=
forms
.
TextInput
(
attrs
=
{
'class'
:
'inp-field'
,
'placeholder'
:
'First Name...'
}))
lname
=
forms
.
CharField
(
widget
=
forms
.
TextInput
(
attrs
=
{
'class'
:
'inp-field'
,
'placeholder'
:
'Last name...'
}))
password
=
forms
.
CharField
(
widget
=
forms
.
TextInput
(
attrs
=
{
'class'
:
'inp-field'
,
'placeholder'
:
'Password...'
}))
password
=
forms
.
CharField
(
widget
=
forms
.
TextInput
(
attrs
=
{
'class'
:
'inp-field'
,
'placeholder'
:
'Password...'
,
'type'
:
'password'
}))
class
Meta
:
model
=
Person
...
...
@@ -32,7 +28,7 @@ class SignupForm(forms.ModelForm):
class
LoginForm
(
forms
.
ModelForm
):
pid
=
forms
.
CharField
(
widget
=
forms
.
TextInput
(
attrs
=
{
'class'
:
'inp-field'
,
'placeholder'
:
'PID...'
}))
password
=
forms
.
CharField
(
widget
=
forms
.
TextInput
(
attrs
=
{
'class'
:
'inp-field'
,
'placeholder'
:
'Password...'
}))
password
=
forms
.
CharField
(
widget
=
forms
.
TextInput
(
attrs
=
{
'class'
:
'inp-field'
,
'placeholder'
:
'Password...'
,
'type'
:
'password'
}))
class
Meta
:
model
=
Person
...
...
discussion/migrations/0001_initial.py
View file @
c9c97d64
# Generated by Django 2.0.3 on 2019-11-0
5 13:26
# Generated by Django 2.0.3 on 2019-11-0
6 07:14
from
django.db
import
migrations
,
models
import
django.db.models.deletion
...
...
@@ -12,19 +12,6 @@ class Migration(migrations.Migration):
]
operations
=
[
migrations
.
CreateModel
(
name
=
'Employee'
,
fields
=
[
(
'id'
,
models
.
AutoField
(
auto_created
=
True
,
primary_key
=
True
,
serialize
=
False
,
verbose_name
=
'ID'
)),
(
'eid'
,
models
.
CharField
(
max_length
=
20
)),
(
'ename'
,
models
.
CharField
(
max_length
=
100
)),
(
'eemail'
,
models
.
EmailField
(
max_length
=
254
)),
(
'econtact'
,
models
.
CharField
(
max_length
=
15
)),
],
options
=
{
'db_table'
:
'employee'
,
},
),
migrations
.
CreateModel
(
name
=
'Like'
,
fields
=
[
...
...
discussion/models.py
View file @
c9c97d64
from
django.db
import
models
class
Employee
(
models
.
Model
):
eid
=
models
.
CharField
(
max_length
=
20
)
ename
=
models
.
CharField
(
max_length
=
100
)
eemail
=
models
.
EmailField
()
econtact
=
models
.
CharField
(
max_length
=
15
)
class
Meta
:
db_table
=
"employee"
class
Person
(
models
.
Model
):
pid
=
models
.
CharField
(
max_length
=
20
)
...
...
@@ -39,6 +31,8 @@ class Subject_Student(models.Model):
class
Meta
:
db_table
=
"subject_student"
def
__str__
(
self
):
return
"
%
s
%
s"
%
(
self
.
student
.
fname
,
self
.
subject
.
sub_name
)
class
Topic
(
models
.
Model
):
...
...
discussion/static/css/login.css
View file @
c9c97d64
...
...
@@ -24,7 +24,11 @@
}
.login-container
{
width
:
70%
;
margin
:
auto
;
}
.login-form-container
{
...
...
discussion/static/css/signup.css
View file @
c9c97d64
...
...
@@ -24,7 +24,11 @@
}
.signup-container
{
width
:
70%
;
margin
:
auto
;
}
.signup-form-container
{
...
...
discussion/static/img/logo.png
0 → 100644
View file @
c9c97d64
43.3 KB
discussion/templates/available_subjects.html
0 → 100644
View file @
c9c97d64
{% extends "base.html" %}
{% block nav-home %}
<li><a
href=
"/"
>
Home
</a></li>
{% endblock %}
{% block nav-subjects %}
<li
><a
href=
"/subjects"
>
My Subjects
</a></li>
{% endblock %}
{% block nav-available-subjects %}
<li
class=
"active"
><a
href=
"/available_subjects"
>
Available Subjects
</a></li>
{% endblock %}
{% block body%}
<div
class=
"container"
style=
"margin-top:50px;"
>
<div
style=
"width: 70%; margin-left: 20px;"
>
<h2>
Available Courses
</h2>
<table
style=
"width:100%;border: solid grey 1px;box-shadow: 2px 2px;"
class=
"table table-hover"
>
<thead>
<tr>
<th
style=
"text-align: center;"
>
Course ID
</th>
<th
style=
"text-align: center;"
>
Course Name
</th>
<th
style=
"text-align: center;"
>
Professor
</th>
<th
style=
"text-align: center;"
>
Status
</th>
</tr>
</thead>
<tbody>
{% for subject in subjects %}
<tr>
<td
style=
"text-align: center;"
>
{{ subject.sub_code }}
</td>
<td
style=
"text-align: center;"
>
{{ subject.sub_name }}
</td>
<td
style=
"text-align: center;"
>
{{ subject.prof.fname }} {{ subject.prof.lname }}
</td>
<td
style=
"text-align: center;"
><button
class=
"btn btn-primary"
>
Request
</button></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endblock %}
discussion/templates/base.html
View file @
c9c97d64
...
...
@@ -42,11 +42,12 @@
{% block nav-home %}
<li
class=
"active"
><a
href=
"/"
>
Home
</a></li>
{% endblock %}
{% if context is not None %}
{% block nav-subjects %}
<li><a
href=
"/subjects"
>
My Subjects
</a></li>
{% endblock %}
{% block nav-
search-subjects %}
<li><a
href=
"/subjects"
>
Search
Subjects
</a></li>
{% endblock %}
{% block nav-
available-subjects %}
<li><a
href=
"/available_subjects"
>
Available
Subjects
</a></li>
{% endblock %}
{% endif %}
</ul>
<ul
class=
"nav navbar-nav navbar-right"
>
<li><a
href=
"/admin"
><span
class=
"glyphicon glyphicon-wrench"
></span>
Admin
</a></li>
{% if context is None %}
{% block nav-signup %}
<li><a
href=
"/signup"
><span
class=
"glyphicon glyphicon-user"
></span>
Sign Up
</a></li>
{%endblock%}
{%block nav-login%}
<li><a
href=
"/login"
><span
class=
"glyphicon glyphicon-log-in"
></span>
Login
</a></li>
{%endblock%}
...
...
discussion/templates/default.html
View file @
c9c97d64
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<link
rel=
"stylesheet"
href=
"navbar.css"
>
<meta
charset=
"utf-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
<link
rel=
"stylesheet"
href=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css"
>
<script
src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"
></script>
<script
src=
"https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"
></script>
</head>
<body
style=
"height:1500px"
>
<nav
class=
"navbar navbar-inverse navbar-fixed-top"
>
<div
class=
"container-fluid"
>
<div
class=
"navbar-header"
>
<a
class=
"navbar-brand"
href=
"#"
>
WebSiteName
</a>
</div>
<ul
class=
"nav navbar-nav"
>
<li
class=
"active"
><a
href=
"#"
>
Home
</a></li>
<li><a
href=
"#"
>
Page 1
</a></li>
<li><a
href=
"#"
>
Page 2
</a></li>
</ul>
<ul
class=
"nav navbar-nav navbar-right"
>
<li><a
href=
"#"
><span
class=
"glyphicon glyphicon-user"
></span>
Sign Up
</a></li>
<li><a
href=
"#"
><span
class=
"glyphicon glyphicon-log-in"
></span>
Login
</a></li>
</ul>
</div>
</nav>
{% extends "base.html" %}
{% block nav-home %}
<li
class=
"active"
><a
href=
"/"
>
Home
</a></li>
{% endblock %}
{% block nav-subjects %}
<li
><a
href=
"/subjects"
>
My Subjects
</a></li>
{% endblock %}
{% block nav-available-subjects %}
<li><a
href=
"/available_subjects"
>
Available Subjects
</a></li>
{% endblock %}
{% block body%}
<div
class=
"container"
style=
"margin-top:70px;"
>
{% load static %}
<img
src=
"{%static 'img/logo.png'%}"
width=
"80%"
height=
"50%"
style=
"margin: auto; padding-left: 18%"
/>
<br><br>
</
body
>
</html>
</
div
>
{% endblock %}
discussion/templates/discussion_topics.html
View file @
c9c97d64
...
...
@@ -10,7 +10,7 @@
<div
class=
"container message-wrap "
style=
"margin-top:50px"
>
<p>
<h3>
Topics in
Subject
Topics in
{{sub_code}}
</h3>
</p>
<div
class=
"list-view"
>
...
...
discussion/templates/login.html
View file @
c9c97d64
...
...
@@ -13,9 +13,11 @@
<
h2
style=
"margin-top:50px;text-align: center;"
>
Login
</h2
>
<
div
class=
"login-container"
>
<form
action=
"/login"
method=
"post"
class=
"login-form"
>
<h2
style=
"margin-top:50px;text-align: center;"
>
Login
</h2>
<form
action=
"/login"
method=
"post"
class=
"login-form"
>
{% csrf_token %}
<div
class=
"login-form-container"
>
...
...
@@ -36,6 +38,10 @@
</div>
</form>
</form>
</div>
{% endblock %}
discussion/templates/signup.html
View file @
c9c97d64
...
...
@@ -11,9 +11,10 @@
{%block nav-login%}
<li><a
href=
"/login"
><span
class=
"glyphicon glyphicon-log-in"
></span>
Login
</a></li>
{%endblock%}
{% block body%}
<h2
style=
"margin-top:50px;text-align:center;"
>
Signup
</h2>
<div
class=
"signup-container"
>
<h2
style=
"margin-top:50px;text-align:center;"
>
Signup
</h2>
<form
action=
"/signup"
method=
"post"
class=
"signup-form"
>
<form
action=
"/signup"
method=
"post"
class=
"signup-form"
>
{% csrf_token %}
<div
class=
"signup-form-container"
>
...
...
@@ -37,6 +38,8 @@
</div>
</form>
</form>
</div>
{% endblock %}
discussion/templates/subjects.html
View file @
c9c97d64
...
...
@@ -3,29 +3,32 @@
{% block nav-home %}
<li><a
href=
"/"
>
Home
</a></li>
{% endblock %}
{% block nav-subjects %}
<li
class=
"active"
><a
href=
"/subjects"
>
My Subjects
</a></li>
{% endblock %}
{% block nav-search-subjects %}
<li><a
href=
"/subjects"
>
Search
Subjects
</a></li>
{% endblock %}
{% block nav-search-subjects %}
<li><a
href=
"/subjects"
>
Available
Subjects
</a></li>
{% endblock %}
{% block body%}
<div
class=
"container"
style=
"margin-top:50px"
>
<div
class=
"container"
style=
"margin-top:50px;"
>
<div
style=
"width: 70%; margin: auto;"
>
<h2>
My Courses
</h2>
<ul>
<table
style=
"width:100%
"
>
<table
style=
"width:100%;border: solid grey 1px;box-shadow: 2px 2px;"
class=
"table table-hover
"
>
<thead>
<tr>
<th
>
Course ID
</th>
<th
>
Course Name
</th>
<th
style=
"text-align: center;"
>
Course ID
</th>
<th
style=
"text-align: center;"
>
Course Name
</th>
<!-- <th>Professor</th> -->
</tr>
</thead>
<tbody>
{% for sub_stu in subject_student %}
<tr>
<td
><a
href=
"/topics/{{ sub_stu.subject.sub_code }}"
>
{{ sub_stu.subject.sub_code }}
</a></td>
<td
>
{{ sub_stu.subject.sub_name }}
</td>
<td
style=
"text-align: center;"
><a
href=
"/topics/{{ sub_stu.subject.sub_code }}"
>
{{ sub_stu.subject.sub_code }}
</a></td>
<td
style=
"text-align: center;"
>
{{ sub_stu.subject.sub_name }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</ul>
</div>
</div>
{% endblock %}
discussion/views.py
View file @
c9c97d64
from
django.shortcuts
import
render
,
redirect
from
discussion.forms
import
EmployeeForm
,
ThreadForm
,
TopicForm
,
SignupForm
,
LoginForm
from
discussion.models
import
Employee
,
Subject_Student
,
Person
,
Subject
,
Topic
,
Thread
,
Person
# Create your views here.
def
emp
(
request
):
if
request
.
method
==
"POST"
:
form
=
EmployeeForm
(
request
.
POST
)
if
form
.
is_valid
():
try
:
form
.
save
()
return
redirect
(
'/show'
)
except
:
pass
else
:
form
=
EmployeeForm
()
return
render
(
request
,
'index.html'
,{
'form'
:
form
})
def
show
(
request
):
employees
=
Employee
.
objects
.
all
()
return
render
(
request
,
"show.html"
,{
'employees'
:
employees
})
def
edit
(
request
,
id
):
employee
=
Employee
.
objects
.
get
(
id
=
id
)
return
render
(
request
,
'edit.html'
,
{
'employee'
:
employee
})
def
update
(
request
,
id
):
employee
=
Employee
.
objects
.
get
(
id
=
id
)
form
=
EmployeeForm
(
request
.
POST
,
instance
=
employee
)
if
form
.
is_valid
():
form
.
save
()
return
redirect
(
"/show"
)
return
render
(
request
,
'edit.html'
,
{
'employee'
:
employee
})
def
destroy
(
request
,
id
):
employee
=
Employee
.
objects
.
get
(
id
=
id
)
employee
.
delete
()
return
redirect
(
"/show"
)
from
discussion.forms
import
ThreadForm
,
TopicForm
,
SignupForm
,
LoginForm
from
discussion.models
import
Subject_Student
,
Person
,
Subject
,
Topic
,
Thread
,
Person
def
login
(
request
):
invalid_user
=
False
...
...
@@ -70,7 +39,7 @@ def logout(request):
del
request
.
session
[
'session_context'
]
except
:
pass
return
render
(
request
,
'
base
.html'
)
return
render
(
request
,
'
default
.html'
)
def
signup
(
request
):
if
request
.
method
==
"POST"
:
...
...
@@ -96,7 +65,7 @@ def default(request):
except
:
context
=
None
return
render
(
request
,
'
base
.html'
,{
'context'
:
context
})
return
render
(
request
,
'
default
.html'
,{
'context'
:
context
})
def
show_subjects
(
request
):
context
=
request
.
session
[
'session_context'
]
...
...
@@ -107,6 +76,12 @@ def show_subjects(request):
subject_student
=
Subject_Student
.
objects
.
filter
(
student
=
person
)
return
render
(
request
,
"subjects.html"
,{
'subject_student'
:
subject_student
,
'context'
:
context
})
def
show_all_subjects
(
request
):
context
=
request
.
session
[
'session_context'
]
subjects
=
Subject
.
objects
.
all
()
return
render
(
request
,
"available_subjects.html"
,{
'subjects'
:
subjects
,
'context'
:
context
})
def
show_topics
(
request
,
id
):
context
=
request
.
session
[
'session_context'
]
try
:
...
...
djangodb
View file @
c9c97d64
No preview for this file type
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment