diff options
author | makfire <mukeshpandey15@hotmail.com> | 2015-07-08 15:37:25 +0530 |
---|---|---|
committer | makfire <mukeshpandey15@hotmail.com> | 2015-07-08 15:37:25 +0530 |
commit | 10bd2dd3fcf8d350e3efc84a77fb68b32d4b14fb (patch) | |
tree | 8db3c4e5d05f50eb9f2a2097262e64496eecefd7 /gnowsys-ndf/gnowsys_ndf | |
parent | 140b91336d7067015d6e7e26126b6157a48cc27a (diff) | |
download | gnowsys-10bd2dd3fcf8d350e3efc84a77fb68b32d4b14fb.tar.gz |
trash view stablished
Diffstat (limited to 'gnowsys-ndf/gnowsys_ndf')
-rw-r--r-- | gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/node_ajax_view.html | 2 | ||||
-rw-r--r-- | gnowsys-ndf/gnowsys_ndf/ndf/urls/__init__.py | 1 | ||||
-rw-r--r-- | gnowsys-ndf/gnowsys_ndf/ndf/urls/trash.py | 7 | ||||
-rw-r--r-- | gnowsys-ndf/gnowsys_ndf/ndf/views/trash.py | 22 |
4 files changed, 31 insertions, 1 deletions
diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/node_ajax_view.html b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/node_ajax_view.html index 59e9cf3..58b6e0b 100644 --- a/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/node_ajax_view.html +++ b/gnowsys-ndf/gnowsys_ndf/ndf/templates/ndf/node_ajax_view.html @@ -1336,7 +1336,7 @@ ul#navigation li a.last { <!-- Delete button if page created by user --> {% if node.created_by == request.user.id %} {% if node.member_of_names_list.0 == "Page" %} - <a class="tiny alert round button" href="{% url 'page_delete' group_name_tag node %}">{% trans "Delete" %}</a> + <a class="tiny alert round button" href="{% url 'trash_resource' group_id node %}">{% trans "Delete" %}</a> {% elif node.member_of_names_list.0 == "Term" %} <a class="tiny alert round button" href="{% url 'term_delete' group_name_tag node %}">{% trans "Delete" %}</a> {% endif %} diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/urls/__init__.py b/gnowsys-ndf/gnowsys_ndf/ndf/urls/__init__.py index ffb3db7..8c02671 100644 --- a/gnowsys-ndf/gnowsys_ndf/ndf/urls/__init__.py +++ b/gnowsys-ndf/gnowsys_ndf/ndf/urls/__init__.py @@ -67,6 +67,7 @@ urlpatterns = patterns('', (r'^(?P<group_id>[^/]+)/observation', include('gnowsys_ndf.ndf.urls.observation')), (r'^(?P<group_id>[^/]+)/compare', include('gnowsys_ndf.ndf.urls.version')), (r'^(?P<group_id>[^/]+)/moderation', include('gnowsys_ndf.ndf.urls.moderation')), + (r'^(?P<group_id>[^/]+)/trash',include('gnowsys_ndf.ndf.urls.trash')), url(r'^(?P<group_id>[^/]+)/topic_details/(?P<app_Id>[\w-]+)', 'gnowsys_ndf.ndf.views.topics.topic_detail_view', name='topic_details'), diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/urls/trash.py b/gnowsys-ndf/gnowsys_ndf/ndf/urls/trash.py new file mode 100644 index 0000000..9073651 --- /dev/null +++ b/gnowsys-ndf/gnowsys_ndf/ndf/urls/trash.py @@ -0,0 +1,7 @@ +from django.conf.urls import patterns, url + +urlpatterns = patterns('gnowsys_ndf.ndf.views.trash', + url(r'^/delete/(?P<node_id>[\w-]+)$', 'trash_resource',name='trash_resource'), + ) + + diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/views/trash.py b/gnowsys-ndf/gnowsys_ndf/ndf/views/trash.py new file mode 100644 index 0000000..043b188 --- /dev/null +++ b/gnowsys-ndf/gnowsys_ndf/ndf/views/trash.py @@ -0,0 +1,22 @@ + +from django.http import HttpResponse +from django.shortcuts import render_to_response # , render +from django.template import RequestContext +from gnowsys_ndf.ndf.models import * +from gnowsys_ndf.ndf.views.page import * + + + + + +def trash_resource(request,group_id,node_id): + node = node_collection.find_one({"_id":ObjectId(node_id)}) + trash_node = node_collection.find_one({"name":"Trash"}); + if ObjectId(group_id) in node.group_set: + node.group_set.remove(ObjectId(group_id)) + #fetch the tarsh group id + if trash_node._id not in node.group_set: + node.group_set.append(trash_node._id) + print "node",node.group_set + node.save() + return (eval('page')(request, group_id)) |