diff options
author | CruiseDevice | 2020-04-14 20:13:52 +0530 |
---|---|---|
committer | CruiseDevice | 2020-04-14 20:13:52 +0530 |
commit | 508e0e78bb0bd3e8ebbad81e948f13de5c01b20f (patch) | |
tree | 1c320cf927c4f594c11ad86f564dc82f206a2a39 /yaksh/templates | |
parent | 2f9331717075b34534f2745706f57a98f7dce20d (diff) | |
download | online_test-508e0e78bb0bd3e8ebbad81e948f13de5c01b20f.tar.gz online_test-508e0e78bb0bd3e8ebbad81e948f13de5c01b20f.tar.bz2 online_test-508e0e78bb0bd3e8ebbad81e948f13de5c01b20f.zip |
Change model name Thread to Post to avoid conflicts
- Thread class from threading conflicts with the forum Thread model.
- Tests for models and views.
- PEP8 fix.
Diffstat (limited to 'yaksh/templates')
-rw-r--r-- | yaksh/templates/yaksh/course_forum.html | 32 | ||||
-rw-r--r-- | yaksh/templates/yaksh/post_comments.html (renamed from yaksh/templates/yaksh/thread_comments.html) | 23 |
2 files changed, 30 insertions, 25 deletions
diff --git a/yaksh/templates/yaksh/course_forum.html b/yaksh/templates/yaksh/course_forum.html index 41dbd7b..407296f 100644 --- a/yaksh/templates/yaksh/course_forum.html +++ b/yaksh/templates/yaksh/course_forum.html @@ -10,16 +10,16 @@ <center>Discussion Forum</center> </div> <div class="pull-right"> - <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#newThreadModal">New Thread</button> + <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#newPostModal">New Post</button> </div> <!-- Modal --> - <div id="newThreadModal" class="modal fade" role="dialog"> + <div id="newPostModal" class="modal fade" role="dialog"> <div class="modal-dialog"> <!-- Modal content--> <div class="modal-content"> <div class="modal-header"> - <h4 class="modal-title">Create a new thread</h4> + <h4 class="modal-title">Create a new Post</h4> <button type="button" class="close" data-dismiss="modal">×</button> </div> <div class="modal-body"> @@ -28,7 +28,7 @@ {% csrf_token %} {{form}} </div> - <input type="submit" class="btn btn-primary" value="Create Thread"> + <input type="submit" class="btn btn-primary" value="Create Post"> </form> </div> <div class="modal-footer"> @@ -41,31 +41,33 @@ <br> <br> <div> - <h3>Threads:</h3> - {% if threads %} - {% for thread in threads %} + <h3>Posts:</h3> + {% if posts %} + {% for post in posts %} <div class="card"> <div class="card-body"> - <a href="{% url "yaksh:thread_comments" course.id thread.uid %}">{{thread.title}}</a> + <a href="{% url "yaksh:post_comments" course.id post.uid %}">{{post.title}}</a> <br> - {% if thread.image %} - <img src="{{thread.image.url}}" class="thread_image"> + {% if post.image %} + <img src="{{post.image.url}}" class="post_image"> {% endif %} - <p class="pull-right"><small>{{thread.get_comments_count}}{% if thread.get_comments_count > 1 %} replies{% else %} reply{% endif %}</small></p> + <p class="pull-right"><small>{{post.get_comments_count}}{% if post.get_comments_count > 1 %} replies{% else %} reply{% endif %}</small></p> </div> <div class="card-footer"> - {% with thread.get_last_comment as last_comment %} - <small> {% if thread.creator.profile.is_moderator %} INSTRUCTOR CREATED {% endif %} Last Post by: <strong>{{last_comment.creator}}</strong> . {{last_comment.modified_at|naturaltime}}</small> + {% with post.get_last_comment as last_comment %} + {% if last_comment %} + <small> {% if post.creator.profile.is_moderator %} INSTRUCTOR CREATED {% endif %} Last Post by: <strong>{{last_comment.creator}}</strong> . {{last_comment.modified_at|naturaltime}}</small> + {% endif %} {% endwith %} {% if user.profile.is_moderator %} - <small><a href="{% url "yaksh:hide_thread" course.id thread.uid %}" class="pull-right">Delete</i></a></small> + <small><a href="{% url "yaksh:hide_post" course.id post.uid %}" class="pull-right">Delete</i></a></small> {% endif %} </div> </div> <br> {% endfor %} {% else %} - No discussion threads are there yet. Create one to start discussing. + No discussion posts are there yet. Create one to start discussing. {% endif %} </div> </div> diff --git a/yaksh/templates/yaksh/thread_comments.html b/yaksh/templates/yaksh/post_comments.html index f614b7a..89f0762 100644 --- a/yaksh/templates/yaksh/thread_comments.html +++ b/yaksh/templates/yaksh/post_comments.html @@ -1,25 +1,28 @@ {% extends "user.html" %} {% block title %} - {{thread.title}} + {{post.title}} {% endblock title %} {% block content %} <div class="container"> - <a class="btn btn-primary" href="{% url "yaksh:course_forum" thread.course.id %}">Back to Threads</a> + <a class="btn btn-primary" href="{% url "yaksh:course_forum" post.course.id %}">Back to Posts</a> <div class="card"> <div class="card-header"> - {{thread.title}} + {{post.title}} <br> <small> - <strong>{{thread.creator.username}}</strong> - {{thread.created_at}} - {% if user.profile.is_moderator %}<a href="{% url "yaksh:hide_thread" thread.course.id thread.uid %}" class="pull-right">Delete</a>{% endif %} + <strong>{{post.creator.username}}</strong> + {{post.created_at}} + {% if user.profile.is_moderator %}<a href="{% url "yaksh:hide_post" post.course.id post.uid %}" class="pull-right">Delete</a>{% endif %} </small> </div> <div class="card-body"> - <p>{{thread.description}}</p> + <p>{{post.description}}</p> + <a href="{{post.image.url}}" target="_blank"> + <img src="{{post.image.url}}" alt=""> + </a> </div> </div> <br> @@ -36,18 +39,18 @@ <p>{{comment.description}}</p> <small class="pull-right"> by: <strong>{{comment.creator.username}} </strong>. {{comment.created_at}} - {% if user.profile.is_moderator %}<a href="{% url "yaksh:hide_comment" thread.course.id comment.uid %}">Delete</a>{% endif %} + {% if user.profile.is_moderator %}<a href="{% url "yaksh:hide_comment" post.course.id comment.uid %}">Delete</a>{% endif %} </small> </div> <hr> {% endfor %} {% else %} - No comments on this thread. + No comments on this post. {% endif %} </div> <br> <div> - <form action="{% url "yaksh:thread_comments" thread.course.id thread.uid %}" method="POST" enctype='multipart/form-data'> + <form action="{% url "yaksh:post_comments" post.course.id post.uid %}" method="POST" enctype='multipart/form-data'> <div class="form-group"> {% csrf_token %} {{form}} |