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
a892bce0
Commit
a892bce0
authored
Nov 26, 2019
by
AMAN MORESHWAR JANGDE
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Threads view for professors impl
parent
f54704fc
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
169 additions
and
11 deletions
+169
-11
.gitignore
.gitignore
+0
-1
discussion/forms.py
discussion/forms.py
+13
-2
discussion/static/css/prof_subjects.css
discussion/static/css/prof_subjects.css
+15
-0
discussion/templates/base.html
discussion/templates/base.html
+1
-0
discussion/templates/discussion_thread.html
discussion/templates/discussion_thread.html
+6
-5
discussion/templates/prof_discussion_threads.html
discussion/templates/prof_discussion_threads.html
+77
-0
discussion/templates/prof_subjects.html
discussion/templates/prof_subjects.html
+27
-0
discussion/views.py
discussion/views.py
+30
-3
djangodb
djangodb
+0
-0
No files found.
.gitignore
View file @
a892bce0
djangodb
\ No newline at end of file
discussion/forms.py
View file @
a892bce0
from
django
import
forms
from
discussion.models
import
Thread
,
Topic
,
Person
from
discussion.models
import
Thread
,
Topic
,
Person
,
Subject
class
ThreadForm
(
forms
.
ModelForm
):
msg
=
forms
.
CharField
(
widget
=
forms
.
Textarea
(
attrs
=
{
'class'
:
'form-control send-message'
,
'rows'
:
'3'
,
'placeholder'
:
'Comment...'
}))
...
...
@@ -16,6 +16,16 @@ class TopicForm(forms.ModelForm):
fields
=
"__all__"
exclude
=
(
"subject"
,)
class
SubjectForm
(
forms
.
ModelForm
):
sub_code
=
forms
.
CharField
(
widget
=
forms
.
TextInput
(
attrs
=
{
'class'
:
'inp-field'
,
'placeholder'
:
'Subject Code...'
}))
sub_name
=
forms
.
CharField
(
widget
=
forms
.
TextInput
(
attrs
=
{
'class'
:
'inp-field'
,
'placeholder'
:
'Subject Title...'
}))
# sub_detail = forms.CharField(widget=forms.Textarea(attrs={'class' : 'inp-field', 'placeholder':'Details...'}))
class
Meta
:
model
=
Subject
fields
=
"__all__"
exclude
=
(
"prof"
,
"sub_detail"
)
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...'
}))
...
...
@@ -33,3 +43,4 @@ class LoginForm(forms.ModelForm):
class
Meta
:
model
=
Person
fields
=
(
'pid'
,
'password'
)
discussion/static/css/prof_subjects.css
0 → 100644
View file @
a892bce0
.inp-field
{
width
:
100%
;
padding
:
12px
20px
;
margin
:
8px
0
;
display
:
inline-block
;
border
:
1px
solid
#ccc
;
box-sizing
:
border-box
;
}
.add-subject-form-container
{
padding
:
16px
;
}
discussion/templates/base.html
View file @
a892bce0
...
...
@@ -5,6 +5,7 @@
<link
rel=
"stylesheet"
href=
"{% static 'css/base.css' %}"
>
{% block style-discussion-thread %}{% endblock %}
{% block style-discussion-topics %}{% endblock %}
{% block style-prof-subject %}{% endblock %}
{% block style-login %}{% endblock %}
{% block style-signup %}{% endblock %}
...
...
discussion/templates/discussion_thread.html
View file @
a892bce0
...
...
@@ -2,10 +2,11 @@
{% extends "base.html" %}
{% load static %}
{% block style-discussion-thread %}
<link
rel=
"stylesheet"
href=
"{% static 'css/discussion_thread.css' %}"
>
{% endblock %}
{% block nav-home %}
<li><a
href=
"/"
>
Home
</a></li>
{% endblock %}
{% block nav-home %}
<li><a
href=
"/"
>
Home
</a></li>
{% endblock %}
{% 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-search-subjects %}
<li><a
href=
"/subjects"
>
Available Subjects
</a></li>
{% endblock %}
{% block nav-pending-subjects %}
<li
><a
href=
"/pending_subjects"
>
Pending Requests
</a></li>
{% endblock %}
{% block body%}
<div
class=
"container"
style=
"margin-top:50px"
>
<div
class=
"row"
>
...
...
@@ -46,7 +47,7 @@
<small
class=
"col-lg-10"
>
{{thread.msg}}
</small>
</div>
<div
class=
"msg-footer-link col-sm-6 col-lg-4"
>
<
a><div
class=
"col-sm-4 col-lg-4 fa fa-comment"
><span>
</span>
Reply
<span>
999
</span></div></a
>
<
!-- <a><div class="col-sm-4 col-lg-4 fa fa-comment"><span> </span>Reply <span>999</span></div></a> --
>
<!-- <div class="col-sm-1">|</div> -->
<a><div
class=
"col-sm-4 col-lg-4 fa fa-thumbs-up"
><span>
</span>
Agree
<span>
{{thread.likes}}
</span></div></a>
<!-- <div class="col-sm-1">|</div> -->
...
...
@@ -67,7 +68,7 @@
</div>
</div>
<div
class=
""
>
<button
type=
"submit"
class=
" col-sm-4 btn send-message-btn"
role=
"button"
><i
class=
"fa fa-plus"
></i>
Send Message
</a>
<button
type=
"submit"
class=
" col-sm-4 btn send-message-btn"
role=
"button"
><i
class=
"fa fa-plus"
></i>
Reply
</a>
</div>
</div>
</div>
...
...
discussion/templates/prof_discussion_threads.html
0 → 100644
View file @
a892bce0
{% extends "base.html" %}
{% load static %}
{% block style-discussion-thread %}
<link
rel=
"stylesheet"
href=
"{% static 'css/discussion_thread.css' %}"
>
{% endblock %}
{% block nav-brand %}
<a
class=
"navbar-brand"
href=
"/prof"
>
Coursebook
</a>
{% endblock %}
{% block nav-home %}
<li
><a
href=
"/prof"
>
Home
</a></li>
{% endblock %}
{% block nav-subjects %}
<li
><a
href=
"/prof/subjects"
>
My Subjects
</a></li>
{% endblock %}
{% block nav-available-subjects %}{% endblock %}
{% block nav-profile %}
<li><a
href=
"/prof"
><span
class=
"glyphicon glyphicon-user"
></span>
{{context}}
</a></li>
{%endblock%}
{% block body%}
<div
class=
"container"
style=
"margin-top:50px"
>
<div
class=
"row"
>
<!-- <div class="col-sm-2">
</div> -->
<div
class=
" col-sm-12"
>
<div
class=
"btn-panel btn-panel-conversation"
>
<a
href=
""
class=
"btn col-sm-3 send-message-btn pull-left"
role=
"button"
><i
class=
"fa fa-search"
></i>
Search
</a>
</div>
<div
class=
"btn-panel btn-panel-msg"
>
<a
href=
""
class=
"btn col-sm-3 send-message-btn pull-right"
role=
"button"
><i
class=
"fa fa-gears"
></i>
Settings
</a>
</div>
</div>
</div>
<div
class=
"row"
>
<div
class=
"message-wrap col-sm-12"
>
<div
class=
"msg-wrap"
>
{% for thread in threads %}
<div
class=
"media msg card bg-success text-white"
>
<!-- <a class="pull-left" href="#">
<img class="media-object" data-src="holder.js/64x64" alt="64x64" style="width: 32px; height: 32px;" src="">
</a> -->
<div
class=
"media-body card-body"
>
<h4
class=
"media-heading"
>
{{thread.title}}
</h4>
<div><span
class=
"msg-owner"
>
- {{thread.person.fname}}
</span>
<span
class=
"time"
><i
class=
"fa fa-clock-o"
></i>
{{thread.time}}
</span></div>
<small
class=
"col-lg-10"
>
{{thread.msg}}
</small>
</div>
<div
class=
"msg-footer-link col-sm-6 col-lg-4"
>
<!-- <a><div class="col-sm-4 col-lg-4 fa fa-comment"><span> </span>Reply <span>999</span></div></a> -->
<!-- <div class="col-sm-1">|</div> -->
<a><div
class=
"col-sm-4 col-lg-4 fa fa-thumbs-up"
><span>
</span>
Agree
<span>
{{thread.likes}}
</span></div></a>
<!-- <div class="col-sm-1">|</div> -->
<a><div
class=
"col-sm-4 col-lg-4 fa fa-thumbs-down"
><span>
</span>
Disagree
<span>
{{thread.dislikes}}
</span></div></a>
</div>
</div>
{% endfor %}
</div>
<div
class=
"send-wrap "
>
<form
method=
"POST"
class=
"post-form"
action=
"/threads/{{topic_id}}"
>
{% csrf_token %}
<div>
{{form.title}}
</div>
<div>
{{form.msg}}
</div>
</div>
<div
class=
""
>
<button
type=
"submit"
class=
" col-sm-4 btn send-message-btn"
role=
"button"
><i
class=
"fa fa-plus"
></i>
Reply
</a>
</div>
</div>
</div>
{% endblock %}
discussion/templates/prof_subjects.html
View file @
a892bce0
{% extends "base.html" %}
{% load static %}
{% block style-prof-subject %}
<link
rel=
"stylesheet"
href=
"{% static 'css/prof_subjects.css' %}"
>
{% endblock %}
{% block nav-brand %}
<a
class=
"navbar-brand"
href=
"/prof"
>
Coursebook
</a>
{% endblock %}
{% block nav-home %}
<li
><a
href=
"/prof"
>
Home
</a></li>
{% endblock %}
...
...
@@ -33,6 +36,30 @@
</table>
<form
action=
"/prof/subjects/"
method=
"post"
class=
"add-subject-form-container"
>
{% csrf_token %}
<div
class=
"add-subject-form-container"
>
<div>
<label
for=
"sub_code"
><b>
Subject Code
</b></label>
{{form.sub_code}}
</div>
<div>
<label
for=
"sub_name"
><b>
Subject Title
</b></label>
{{form.sub_name}}
</div>
<!-- <label for="sub_detail"><b>Details</b></label>
{{form.sub_detail}} -->
<button
type=
"submit"
class=
"signup-button btn btn-success"
>
Add Subject
</button>
</div>
</form>
</div>
</div>
...
...
discussion/views.py
View file @
a892bce0
from
django.shortcuts
import
render
,
redirect
from
discussion.forms
import
ThreadForm
,
TopicForm
,
SignupForm
,
LoginForm
from
discussion.forms
import
ThreadForm
,
TopicForm
,
SignupForm
,
SubjectForm
,
LoginForm
from
discussion.models
import
Subject_Student
,
Person
,
Subject
,
Topic
,
Thread
,
Person
def
login
(
request
):
...
...
@@ -89,8 +89,23 @@ def prof_subjects(request):
except
:
subjects
=
None
if
request
.
method
==
"POST"
:
form
=
SubjectForm
(
request
.
POST
)
if
form
.
is_valid
():
try
:
subject
=
form
.
save
(
commit
=
False
)
subject
.
prof
=
prof
form
.
save
()
return
redirect
(
'/prof/subjects'
)
except
Exception
as
e
:
print
(
e
)
else
:
form
=
SubjectForm
()
return
render
(
request
,
"prof_subjects.html"
,{
'subjects'
:
subjects
,
'context'
:
context
})
return
render
(
request
,
"prof_subjects.html"
,{
'subjects'
:
subjects
,
'context'
:
context
,
'form'
:
form
})
def
student_list
(
request
,
sub_code
):
context
=
request
.
session
[
'session_context'
]
...
...
@@ -215,6 +230,8 @@ def show_topics(request, id):
try
:
topic
=
form
.
save
(
commit
=
False
)
topic
.
subject
=
subject
if
is_prof
:
topic
.
is_prof_included
=
True
form
.
save
()
return
redirect
(
'/topics/'
+
str
(
id
))
...
...
@@ -230,6 +247,12 @@ def show_topics(request, id):
def
show_threads
(
request
,
id
):
context
=
request
.
session
[
'session_context'
]
is_prof
=
False
try
:
person
=
Person
.
objects
.
get
(
pid
=
context
)
is_prof
=
person
.
is_prof
except
Exception
as
e
:
print
(
e
)
try
:
topic
=
Topic
.
objects
.
get
(
id
=
id
)
except
:
...
...
@@ -251,4 +274,8 @@ def show_threads(request, id):
pass
else
:
form
=
ThreadForm
()
return
render
(
request
,
'discussion_thread.html'
,{
'form'
:
form
,
'topic_id'
:
id
,
'threads'
:
threads
,
'context'
:
context
})
\ No newline at end of file
if
is_prof
:
return
render
(
request
,
'prof_discussion_threads.html'
,{
'form'
:
form
,
'topic_id'
:
id
,
'threads'
:
threads
,
'context'
:
context
,
'is_prof'
:
is_prof
})
else
:
return
render
(
request
,
'discussion_thread.html'
,{
'form'
:
form
,
'topic_id'
:
id
,
'threads'
:
threads
,
'context'
:
context
,
'is_prof'
:
is_prof
})
\ No newline at end of file
djangodb
View file @
a892bce0
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