summaryrefslogtreecommitdiff
path: root/gnowsys-ndf/gnowsys_ndf
diff options
context:
space:
mode:
authorkrishna31 <kpkrishnapal@gmail.com>2014-01-29 16:17:48 +0530
committerkrishna31 <kpkrishnapal@gmail.com>2014-01-29 16:17:48 +0530
commitb9b26a5db8ed3dfdea05cec07affe4647861976a (patch)
tree2a014a528d838780c5e4a82ae3d9e1a824fdcc7a /gnowsys-ndf/gnowsys_ndf
parentc7070989699f3e0215cac1bc77c344662f3bcd58 (diff)
downloadgnowsys-b9b26a5db8ed3dfdea05cec07affe4647861976a.tar.gz
started course bulding
Diffstat (limited to 'gnowsys-ndf/gnowsys_ndf')
-rw-r--r--gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/course.html34
-rw-r--r--gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/file.html2
-rw-r--r--gnowsys-ndf/gnowsys_ndf/ndf/urls/__init__.py1
-rw-r--r--gnowsys-ndf/gnowsys_ndf/ndf/urls/course.py6
-rw-r--r--gnowsys-ndf/gnowsys_ndf/ndf/urls/file.py3
-rw-r--r--gnowsys-ndf/gnowsys_ndf/ndf/views/course.py33
6 files changed, 75 insertions, 4 deletions
diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/course.html b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/course.html
new file mode 100644
index 00000000..7ae7fc2b
--- /dev/null
+++ b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/course.html
@@ -0,0 +1,34 @@
+{% extends "ndf/base.html" %}
+{% block title %} {{title}} {% endblock %}
+{% block body_content %}
+<div class="row">
+ <div class="small-3 large-3 columns">
+ <a href="#" class="button">create</a>
+ </div>
+</div>
+<div class="row">
+ <div class="small-6 large-12 columns">
+ <ul class="pricing-table">
+ {% for course in course_coll %}
+ <li class="bullet-item text-left">
+ <div class="row">
+ <div class="small-5 columns ">
+ <a href="{% url 'page_details' group_name course %}">
+ <b>{{course.name}}</b>
+ </a>
+ </div>
+ <div class="small-7 columns text-right">
+ <i class="label secondary" >Created by {{course.user_details_dict.created_by}} on {{course.created_at|date:"j F Y"}} </i>
+ </div>
+ <div class="small-12 columns" style="padding-top:5px;">
+ {{ course.html_content|removetags:"h1 p"|safe|truncatewords:15 }}
+ </div>
+ </div>
+ </li>
+ { % empty %}
+ <p> <em> No Course available in this group !!</em></P>
+ {% endfor %}
+ </ul>
+ </div>
+</div>
+{% endblock %}
diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/file.html b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/file.html
index 9de39253..5c24e3e7 100644
--- a/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/file.html
+++ b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/file.html
@@ -69,7 +69,7 @@
</tbody>
</table>
{% else %}
- <p><em>Currently NO nodes in the gnowledge base!!!</em></p>
+ <p><em>Currently NO files uploaded!!!</em></p>
{% endif %}
{% endblock %}
diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/urls/__init__.py b/gnowsys-ndf/gnowsys_ndf/ndf/urls/__init__.py
index aa49b2e3..d5b357bb 100644
--- a/gnowsys-ndf/gnowsys_ndf/ndf/urls/__init__.py
+++ b/gnowsys-ndf/gnowsys_ndf/ndf/urls/__init__.py
@@ -18,6 +18,7 @@ urlpatterns = patterns('',
(r'^(?P<group_name>[^/]+)/group/', include('gnowsys_ndf.ndf.urls.group')),
(r'^(?P<group_name>[^/]+)/forum/', include('gnowsys_ndf.ndf.urls.forum')),
(r'^(?P<group_name>[^/]+)/quiz/', include('gnowsys_ndf.ndf.urls.quiz')),
+ (r'^(?P<group_name>[^/]+)/course/', include('gnowsys_ndf.ndf.urls.course')),
(r'^(?P<group_name>[^/]+)/ajax/', include('gnowsys_ndf.ndf.urls.ajax-urls')),
(r'^(?P<group_name>[^/]+)/',include('gnowsys_ndf.ndf.urls.group')),
# (r'^home/', 'gnowsys_ndf.ndf.views.home.homepage'),
diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/urls/course.py b/gnowsys-ndf/gnowsys_ndf/ndf/urls/course.py
new file mode 100644
index 00000000..4642d467
--- /dev/null
+++ b/gnowsys-ndf/gnowsys_ndf/ndf/urls/course.py
@@ -0,0 +1,6 @@
+from django.conf.urls import patterns, url
+from gnowsys_ndf.ndf.views import *
+
+urlpatterns = patterns('gnowsys_ndf.ndf.views.course',
+ url(r'^(?P<course_id>[\w-]+)$', 'course', name='course'),
+ )
diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/urls/file.py b/gnowsys-ndf/gnowsys_ndf/ndf/urls/file.py
index 495e9c8e..e6604895 100644
--- a/gnowsys-ndf/gnowsys_ndf/ndf/urls/file.py
+++ b/gnowsys-ndf/gnowsys_ndf/ndf/urls/file.py
@@ -6,9 +6,6 @@ from django.views.generic import TemplateView
from gnowsys_ndf.ndf.views import *
-
-
-
urlpatterns = patterns('gnowsys_ndf.ndf.views.file',
url(r'^(?P<file_id>[\w-]+)$', 'file', name='file'),
#url(r'^uploadDoc/$', TemplateView.as_view(template_name='ndf/UploadDoc.html')), #Direct ot html template
diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/views/course.py b/gnowsys-ndf/gnowsys_ndf/ndf/views/course.py
new file mode 100644
index 00000000..c513c5b0
--- /dev/null
+++ b/gnowsys-ndf/gnowsys_ndf/ndf/views/course.py
@@ -0,0 +1,33 @@
+#from django.http import HttpResponseRedirect
+#from django.http import HttpResponse
+from django.shortcuts import render_to_response #render uncomment when to use
+from django.template import RequestContext
+from django.core.urlresolvers import reverse
+#from django.contrib.auth.decorators import login_required
+from django_mongokit import get_database
+
+
+try:
+ from bson import ObjectId
+except ImportError: # old pymongo
+ from pymongo.objectid import ObjectId
+
+from gnowsys_ndf.settings import GAPPS, MEDIA_ROOT
+from gnowsys_ndf.ndf.models import GSystemType, Node
+
+
+db = get_database()
+collection = db[Node.collection_name]
+GST_COLLECTION = db[GSystemType.collection_name]
+GST_COURSE = GST_COLLECTION.GSystemType.one({'name': GAPPS[7]})
+
+def course(request, group_name, course_id):
+ """
+ * Renders a list of all 'courses' available within the database.
+ """
+ if GST_COURSE._id == ObjectId(course_id):
+ title = GST_COURSE.name
+ course_coll = collection.GSystem.find({'gsystem_type': {'$all': [ObjectId(course_id)]}, 'group_set': {'$all': [group_name]}})
+ template = "ndf/course.html"
+ variable = RequestContext(request, {'course_coll': course_coll })
+ return render_to_response(template, variable)