| author | cavaliet |
| Mon, 20 Jun 2011 15:49:22 +0200 | |
| changeset 46 | 3ad571e54608 |
| parent 44 | 244d805b4921 |
| child 47 | 08b008c5a07d |
| permissions | -rw-r--r-- |
|
42
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
1 |
# -*- coding: utf-8 -*- |
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
2 |
|
| 27 | 3 |
from django.conf import settings |
4 |
from django.contrib.auth.decorators import login_required #@UnusedImport |
|
|
32
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
5 |
from django.core.paginator import Paginator |
| 28 | 6 |
from django.db.models import Max |
|
44
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
7 |
from django.http import HttpResponse, HttpResponseBadRequest |
|
34
26368d096723
Datasheet validation, better repartition of js function, hand cursor on buttons.
cavaliet
parents:
32
diff
changeset
|
8 |
from django.shortcuts import render_to_response, redirect |
| 27 | 9 |
from django.template import RequestContext |
|
42
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
10 |
from haystack.constants import DJANGO_ID |
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
11 |
from haystack.query import SearchQuerySet |
| 27 | 12 |
from hdabo.management.commands.querywikipedia import process_tag |
|
42
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
13 |
from hdabo.wp_utils import (normalize_tag, query_wikipedia_title, |
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
14 |
get_or_create_tag) |
| 46 | 15 |
from hdabo.utils import OrderedDict |
|
44
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
16 |
from models import Datasheet, Organisation, Tag, TagCategory, TaggedSheet |
| 27 | 17 |
from wikitools import wiki |
|
42
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
18 |
import django.utils.simplejson as json |
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
19 |
|
| 27 | 20 |
|
21 |
||
22 |
#@login_required |
|
23 |
def home(request): |
|
24 |
||
25 |
# Get all organisations |
|
|
32
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
26 |
orgas = Organisation.objects.all().order_by('name') |
| 27 | 27 |
# Count all validated, unvalidated sheets for each organisation |
28 |
org_list = [] |
|
29 |
for orga in orgas : |
|
30 |
all_datasheets = Datasheet.objects.filter(organisation=orga) |
|
31 |
nb_all = len(all_datasheets) |
|
32 |
nb_val = len(all_datasheets.filter(validated=True)) |
|
33 |
nb_unval = len(all_datasheets.filter(validated=False)) |
|
34 |
org_list.append({'organisation':orga, 'nb_all':nb_all, 'nb_val':nb_val, 'nb_unval':nb_unval}) |
|
35 |
||
| 28 | 36 |
return render_to_response("organisation_list.html", |
| 27 | 37 |
{'organisations':org_list}, |
38 |
context_instance=RequestContext(request)) |
|
39 |
||
40 |
||
41 |
#@login_required |
|
42 |
def list_for_orga(request, orga_id=None, valid=None, start_index=None): |
|
43 |
||
44 |
orga = Organisation.objects.get(id=orga_id) |
|
45 |
orga_name = orga.name |
|
46 |
||
47 |
if start_index : |
|
48 |
try: |
|
49 |
start_index = int(start_index) |
|
50 |
except : |
|
51 |
start_index = 0 |
|
52 |
else : |
|
53 |
start_index = 0 |
|
54 |
||
55 |
# If valid = 0, we search unvalidated sheets |
|
56 |
# If valid = 1, we search validated sheets |
|
57 |
# If valid = 2, we search AND DISPLAY all sheets |
|
58 |
if valid == "1" : |
|
59 |
# We count all the validated sheets |
|
60 |
datasheets = Datasheet.objects.filter(organisation=orga).filter(validated=True) |
|
61 |
nb_sheets = len(datasheets) |
|
62 |
# And select the current one |
|
63 |
datasheets = [datasheets[start_index]] |
|
64 |
elif valid != "2": |
|
|
34
26368d096723
Datasheet validation, better repartition of js function, hand cursor on buttons.
cavaliet
parents:
32
diff
changeset
|
65 |
valid = "0" |
| 27 | 66 |
# We count all the validated sheets |
67 |
datasheets = Datasheet.objects.filter(organisation=orga).filter(validated=False) |
|
68 |
nb_sheets = len(datasheets) |
|
69 |
# And select the current one |
|
70 |
datasheets = [datasheets[start_index]] |
|
71 |
else : |
|
72 |
datasheets = Datasheet.objects.filter(organisation=orga) |
|
73 |
nb_sheets = len(datasheets) |
|
74 |
||
75 |
# We get the ORDERED tags if we display one sheet (case valid = 0 and 1) |
|
76 |
ordered_tags = None |
|
77 |
if valid != "2" : |
|
78 |
ordered_tags = TaggedSheet.objects.filter(datasheet=datasheets[0]).order_by('order') |
|
79 |
||
80 |
displayed_index = start_index + 1; |
|
81 |
prev_index = max(start_index - 1, 0); |
|
82 |
next_index = min(nb_sheets - 1, start_index + 1); |
|
83 |
last_index = max(nb_sheets - 1, 0); |
|
84 |
||
| 28 | 85 |
return render_to_response("list_for_orga.html", |
| 27 | 86 |
{'datasheets':datasheets, 'orga_name':orga_name, |
87 |
'nb_sheets':nb_sheets, 'orga_id':orga_id, 'ordered_tags':ordered_tags, |
|
88 |
'prev_index':prev_index, 'next_index':next_index, 'last_index':last_index, |
|
| 46 | 89 |
'start_index':start_index, 'displayed_index':displayed_index, 'valid':valid, |
90 |
'categories':json.dumps(get_categories())}, |
|
| 27 | 91 |
context_instance=RequestContext(request)) |
92 |
||
|
32
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
93 |
|
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
94 |
#@login_required |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
95 |
def all_tags(request, num_page=None, nb_by_page=None): |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
96 |
|
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
97 |
alltags = Tag.objects.order_by('label') |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
98 |
nb_total = len(alltags) |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
99 |
# We build the paginator for the requested list |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
100 |
if nb_by_page : |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
101 |
try: |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
102 |
nb_by_page = int(nb_by_page) |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
103 |
except : |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
104 |
nb_by_page = 25 |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
105 |
else : |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
106 |
nb_by_page = 25 |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
107 |
if num_page : |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
108 |
try: |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
109 |
num_page = int(num_page) |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
110 |
except : |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
111 |
num_page = 1 |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
112 |
else : |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
113 |
num_page = 1 |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
114 |
p = Paginator(alltags, nb_by_page) |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
115 |
current_page = p.page(num_page) |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
116 |
|
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
117 |
prev_page = max(num_page - 1, 1) |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
118 |
next_page = min(num_page + 1, p.num_pages) |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
119 |
last_page = p.num_pages |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
120 |
|
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
121 |
return render_to_response("all_tags.html", |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
122 |
{'nb_total':nb_total, 'tags':current_page.object_list, 'current_page':current_page, |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
123 |
'prev_page':prev_page, 'next_page':next_page, 'last_page':last_page, |
| 46 | 124 |
'num_page':num_page, 'nb_by_page':nb_by_page, 'categories':json.dumps(get_categories())}, |
|
32
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
125 |
context_instance=RequestContext(request)) |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
126 |
|
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
127 |
|
| 27 | 128 |
#@login_required |
129 |
def tag_up_down(request): |
|
130 |
ds_id = request.POST["datasheet_id"] |
|
|
44
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
131 |
# post vars new_order and old_order indicate the position (from 1) of the tag in the list. |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
132 |
# NB : it is different from the TagSheet.order in the database. |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
133 |
new_order = int(request.POST["new_order"]) - 1 |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
134 |
old_order = int(request.POST["old_order"]) - 1 |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
135 |
s = "new_order = " + str(new_order) + ", old_order = " + str(old_order) |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
136 |
# First we get the datasheet's TaggedSheets (list to force evaluation) |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
137 |
ordered_tags = list(TaggedSheet.objects.filter(datasheet=Datasheet.objects.get(id=ds_id)).order_by('order')) |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
138 |
# We change the moved TaggedSheets's order |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
139 |
new_ts_order = ordered_tags[new_order].order |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
140 |
moved_ts = ordered_tags[old_order] |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
141 |
moved_ts.order = new_ts_order |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
142 |
moved_ts.save() |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
143 |
# We move the TaggedSheets's order |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
144 |
if new_order > old_order : |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
145 |
# And we decrease the other ones |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
146 |
for i in range(old_order+1,new_order+1) : |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
147 |
ts = ordered_tags[i] |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
148 |
ts.order = ts.order - 1 |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
149 |
ts.save() |
| 27 | 150 |
else : |
|
44
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
151 |
# And we increase the other ones |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
152 |
for i in range(new_order,old_order) : |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
153 |
ts = ordered_tags[i] |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
154 |
ts.order = ts.order + 1 |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
155 |
ts.save() |
| 27 | 156 |
|
157 |
return get_tag_table(request=request, ds_id=ds_id, valid=0) |
|
158 |
||
159 |
||
160 |
#@login_required |
|
161 |
def get_tag_table(request=None, ds_id=None, valid=None): |
|
162 |
||
163 |
ordered_tags = TaggedSheet.objects.filter(datasheet=Datasheet.objects.filter(id=ds_id)[0]).order_by('order') |
|
164 |
||
165 |
return render_to_response("partial/tag_table.html", |
|
166 |
{'ordered_tags':ordered_tags, 'valid':valid}, |
|
167 |
context_instance=RequestContext(request)) |
|
168 |
||
169 |
||
170 |
#@login_required |
|
|
32
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
171 |
def get_all_tags_table(request, num_page=None, nb_by_page=None): |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
172 |
|
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
173 |
alltags = Tag.objects.order_by('label') |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
174 |
# We build the paginator for the requested list |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
175 |
if nb_by_page : |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
176 |
try: |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
177 |
nb_by_page = int(nb_by_page) |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
178 |
except : |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
179 |
nb_by_page = 25 |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
180 |
else : |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
181 |
nb_by_page = 25 |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
182 |
if num_page : |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
183 |
try: |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
184 |
num_page = int(num_page) |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
185 |
except : |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
186 |
num_page = 1 |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
187 |
else : |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
188 |
num_page = 1 |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
189 |
p = Paginator(alltags, nb_by_page) |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
190 |
current_page = p.page(num_page) |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
191 |
|
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
192 |
return render_to_response("partial/all_tags_table.html", |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
193 |
{'tags':current_page.object_list}, |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
194 |
context_instance=RequestContext(request)) |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
195 |
|
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
196 |
|
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
197 |
#@login_required |
| 27 | 198 |
def remove_tag_from_list(request=None): |
199 |
||
200 |
ds_id = request.POST["datasheet_id"] |
|
201 |
tag_id = request.POST["tag_id"] |
|
202 |
# First we get the datasheet's TaggedSheets |
|
203 |
ds_tags = TaggedSheet.objects.filter(datasheet=Datasheet.objects.filter(id=ds_id)[0]) |
|
204 |
# We get the current TaggedSheet and we delete it |
|
205 |
ts = ds_tags.filter(tag=Tag.objects.filter(id=tag_id))[0] |
|
206 |
ts.delete() |
|
207 |
||
208 |
return get_tag_table(request=request, ds_id=ds_id, valid=0) |
|
209 |
||
210 |
||
211 |
#@login_required |
|
212 |
def modify_tag(request): |
|
|
42
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
213 |
|
| 27 | 214 |
tag_id = request.POST["id"] |
215 |
tag_label = request.POST["value"] |
|
216 |
||
217 |
tag = Tag.objects.get(id=tag_id) |
|
218 |
||
219 |
if tag.label != tag_label: |
|
220 |
||
|
44
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
221 |
|
| 27 | 222 |
tag.label = tag_label |
223 |
||
224 |
site = wiki.Wiki(settings.WIKIPEDIA_API_URL) #@UndefinedVariable |
|
225 |
new_label, status, url, pageid, response = query_wikipedia_title(site, tag_label) #@UnusedVariable |
|
226 |
||
227 |
if status is not None: |
|
228 |
tag.url_status = status |
|
229 |
if url is not None: |
|
230 |
tag.wikipedia_url = url |
|
231 |
else: |
|
232 |
tag.wikipedia_url = None |
|
233 |
||
234 |
if pageid is not None: |
|
235 |
tag.wikipedia_pageid = pageid |
|
236 |
else: |
|
237 |
tag.wikipedia_pageid = None |
|
238 |
||
239 |
tag.save() |
|
240 |
||
|
42
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
241 |
return get_all_tags_table(request=request, num_page=request.POST["num_page"], nb_by_page=request.POST["nb_by_page"]) |
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
242 |
|
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
243 |
|
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
244 |
#@login_required |
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
245 |
def modify_tag_datasheet(request): |
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
246 |
|
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
247 |
tag_id = request.POST["id"] |
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
248 |
tag_label = request.POST["value"] |
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
249 |
ds_id=request.POST["datasheet_id"] |
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
250 |
|
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
251 |
tag = Tag.objects.get(id=tag_id) |
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
252 |
|
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
253 |
ds = Datasheet.objects.get(id=ds_id) |
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
254 |
|
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
255 |
if tag.label != tag_label: |
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
256 |
|
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
257 |
if tag_label.lower() in [t.label.lower() for t in ds.tags.all()]: |
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
258 |
return HttpResponseBadRequest(json.dumps({'error': 'duplicate_tag', 'message': u"Le tag %s existe déjà pour cette fiche." % (tag_label)}), mimetype="application/json") |
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
259 |
|
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
260 |
tag, created = get_or_create_tag(tag_label) #@UnusedVariable |
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
261 |
|
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
262 |
ts = TaggedSheet.objects.get(tag=tag_id, datasheet=ds_id) |
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
263 |
ts.tag = tag |
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
264 |
kwargs = {DJANGO_ID + "__exact": unicode(ds_id)} |
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
265 |
results = SearchQuerySet().filter(title=tag_label).filter_or(description=tag_label).filter(**kwargs) |
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
266 |
if len(results) > 0: |
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
267 |
ts.index_note = results[0].score |
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
268 |
|
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
269 |
ts.save() |
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
270 |
|
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
271 |
|
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
272 |
return get_tag_table(request=request, ds_id=ds_id, valid=0) |
|
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
273 |
|
| 27 | 274 |
|
275 |
||
276 |
#@login_required |
|
277 |
def reset_wikipedia_info(request): |
|
|
32
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
278 |
# 2 cases : |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
279 |
# - ordered tag for one datasheet : POST["datasheet_id"] is not null |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
280 |
# - all tags list : POST["datasheet_id"] is null and POST["num_page"] and POST["nb_by_page"] are not null |
|
31
142d0440c9aa
Remove wp link button activated. Some js function gathered.
cavaliet
parents:
30
diff
changeset
|
281 |
tag_id = request.POST["tag_id"] |
| 27 | 282 |
|
283 |
tag = Tag.objects.get(id=tag_id) |
|
284 |
site = wiki.Wiki(settings.WIKIPEDIA_API_URL) #@UndefinedVariable |
|
285 |
||
286 |
tag.label = normalize_tag(tag.original_label) |
|
287 |
||
| 33 | 288 |
#reset tag info |
289 |
tag.wikipedia_url = None |
|
290 |
tag.wikipedia_pageid = None |
|
| 36 | 291 |
|
| 27 | 292 |
process_tag(site, tag, 0) |
293 |
||
|
32
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
294 |
if u"datasheet_id" in request.POST : |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
295 |
return get_tag_table(request=request, ds_id=request.POST["datasheet_id"], valid=0) |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
296 |
else : |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
297 |
return get_all_tags_table(request=request, num_page=request.POST["num_page"], nb_by_page=request.POST["nb_by_page"]) |
| 28 | 298 |
|
299 |
||
300 |
#@login_required |
|
301 |
def add_tag(request=None): |
|
302 |
||
303 |
ds_id = request.POST["datasheet_id"] |
|
304 |
tag_label = request.POST["value"] |
|
| 43 | 305 |
|
306 |
ds = Datasheet.objects.get(id=ds_id) |
|
307 |
if tag_label.lower() in [t.label.lower() for t in ds.tags.all()]: |
|
308 |
return HttpResponseBadRequest(json.dumps({'error': 'duplicate_tag', 'message': u"Le tag %s existe déjà pour cette fiche." % (tag_label)}), mimetype="application/json") |
|
309 |
||
| 29 | 310 |
|
|
42
861a78f74a37
modify behavior for tag modification on the datasheet
ymh <ymh.work@gmail.com>
parents:
36
diff
changeset
|
311 |
tag, created = get_or_create_tag(tag_label) |
| 28 | 312 |
# We put the tag at the bottom of the datasheet's tag list |
313 |
# if the tag is created or if the tag is not in the list |
|
| 43 | 314 |
|
| 28 | 315 |
list_ts = TaggedSheet.objects.filter(datasheet=ds) |
316 |
if created or len(list_ts.filter(tag=tag))==0 : |
|
317 |
new_order = list_ts.aggregate(Max('order'))['order__max'] + 1 |
|
318 |
ts = TaggedSheet.objects.create(datasheet=ds, tag=tag, original_order=new_order, order=new_order) |
|
319 |
ts.save() |
|
320 |
||
321 |
return get_tag_table(request=request, ds_id=ds_id, valid=0) |
|
322 |
||
|
31
142d0440c9aa
Remove wp link button activated. Some js function gathered.
cavaliet
parents:
30
diff
changeset
|
323 |
|
|
142d0440c9aa
Remove wp link button activated. Some js function gathered.
cavaliet
parents:
30
diff
changeset
|
324 |
#@login_required |
|
142d0440c9aa
Remove wp link button activated. Some js function gathered.
cavaliet
parents:
30
diff
changeset
|
325 |
def remove_wp_link(request=None): |
|
32
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
326 |
# 2 cases : |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
327 |
# - ordered tag for one datasheet : POST["datasheet_id"] is not null |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
328 |
# - all tags list : POST["datasheet_id"] is null and POST["num_page"] and POST["nb_by_page"] are not null |
|
31
142d0440c9aa
Remove wp link button activated. Some js function gathered.
cavaliet
parents:
30
diff
changeset
|
329 |
tag_id = request.POST["tag_id"] |
|
142d0440c9aa
Remove wp link button activated. Some js function gathered.
cavaliet
parents:
30
diff
changeset
|
330 |
tag = Tag.objects.filter(id=tag_id)[0] |
|
142d0440c9aa
Remove wp link button activated. Some js function gathered.
cavaliet
parents:
30
diff
changeset
|
331 |
tag.wikipedia_url = None |
|
142d0440c9aa
Remove wp link button activated. Some js function gathered.
cavaliet
parents:
30
diff
changeset
|
332 |
tag.wikipedia_pageid = None |
|
142d0440c9aa
Remove wp link button activated. Some js function gathered.
cavaliet
parents:
30
diff
changeset
|
333 |
tag.url_status = 0; |
|
142d0440c9aa
Remove wp link button activated. Some js function gathered.
cavaliet
parents:
30
diff
changeset
|
334 |
tag.save() |
|
142d0440c9aa
Remove wp link button activated. Some js function gathered.
cavaliet
parents:
30
diff
changeset
|
335 |
|
|
32
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
336 |
if u"datasheet_id" in request.POST : |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
337 |
return get_tag_table(request=request, ds_id=request.POST["datasheet_id"], valid=0) |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
338 |
else : |
|
ffd77b2b939f
First step of tag list. Enhance js function for datasheet context or tag list context.
cavaliet
parents:
31
diff
changeset
|
339 |
return get_all_tags_table(request=request, num_page=request.POST["num_page"], nb_by_page=request.POST["nb_by_page"]) |
|
34
26368d096723
Datasheet validation, better repartition of js function, hand cursor on buttons.
cavaliet
parents:
32
diff
changeset
|
340 |
|
|
26368d096723
Datasheet validation, better repartition of js function, hand cursor on buttons.
cavaliet
parents:
32
diff
changeset
|
341 |
|
|
26368d096723
Datasheet validation, better repartition of js function, hand cursor on buttons.
cavaliet
parents:
32
diff
changeset
|
342 |
#@login_required |
|
26368d096723
Datasheet validation, better repartition of js function, hand cursor on buttons.
cavaliet
parents:
32
diff
changeset
|
343 |
def validate_datasheet(request=None, ds_id=None, valid=None): |
|
26368d096723
Datasheet validation, better repartition of js function, hand cursor on buttons.
cavaliet
parents:
32
diff
changeset
|
344 |
# We set if valid is true of false, function of the url parameters |
|
26368d096723
Datasheet validation, better repartition of js function, hand cursor on buttons.
cavaliet
parents:
32
diff
changeset
|
345 |
if valid == "1" or valid == "true" or not valid : |
|
26368d096723
Datasheet validation, better repartition of js function, hand cursor on buttons.
cavaliet
parents:
32
diff
changeset
|
346 |
valid = True |
|
26368d096723
Datasheet validation, better repartition of js function, hand cursor on buttons.
cavaliet
parents:
32
diff
changeset
|
347 |
else : |
|
26368d096723
Datasheet validation, better repartition of js function, hand cursor on buttons.
cavaliet
parents:
32
diff
changeset
|
348 |
valid = False |
|
26368d096723
Datasheet validation, better repartition of js function, hand cursor on buttons.
cavaliet
parents:
32
diff
changeset
|
349 |
# We validate or unvalidate the requester datasheet |
|
26368d096723
Datasheet validation, better repartition of js function, hand cursor on buttons.
cavaliet
parents:
32
diff
changeset
|
350 |
ds = Datasheet.objects.get(id=ds_id) |
|
26368d096723
Datasheet validation, better repartition of js function, hand cursor on buttons.
cavaliet
parents:
32
diff
changeset
|
351 |
if valid : |
|
26368d096723
Datasheet validation, better repartition of js function, hand cursor on buttons.
cavaliet
parents:
32
diff
changeset
|
352 |
ds.validate(None) |
|
26368d096723
Datasheet validation, better repartition of js function, hand cursor on buttons.
cavaliet
parents:
32
diff
changeset
|
353 |
else : |
|
26368d096723
Datasheet validation, better repartition of js function, hand cursor on buttons.
cavaliet
parents:
32
diff
changeset
|
354 |
ds.unvalidate() |
|
26368d096723
Datasheet validation, better repartition of js function, hand cursor on buttons.
cavaliet
parents:
32
diff
changeset
|
355 |
ds.save() |
|
26368d096723
Datasheet validation, better repartition of js function, hand cursor on buttons.
cavaliet
parents:
32
diff
changeset
|
356 |
# If there are still some unvalidated/validated ds for the ds's orga, we display the first one |
|
26368d096723
Datasheet validation, better repartition of js function, hand cursor on buttons.
cavaliet
parents:
32
diff
changeset
|
357 |
same_organisation_ds = Datasheet.objects.filter(organisation=ds.organisation).filter(validated=not valid) |
|
26368d096723
Datasheet validation, better repartition of js function, hand cursor on buttons.
cavaliet
parents:
32
diff
changeset
|
358 |
if valid : |
|
26368d096723
Datasheet validation, better repartition of js function, hand cursor on buttons.
cavaliet
parents:
32
diff
changeset
|
359 |
# We ask to display the unvalidated ds |
|
26368d096723
Datasheet validation, better repartition of js function, hand cursor on buttons.
cavaliet
parents:
32
diff
changeset
|
360 |
valid_req = 0 |
|
26368d096723
Datasheet validation, better repartition of js function, hand cursor on buttons.
cavaliet
parents:
32
diff
changeset
|
361 |
else : |
|
26368d096723
Datasheet validation, better repartition of js function, hand cursor on buttons.
cavaliet
parents:
32
diff
changeset
|
362 |
# We ask to display the validated ds |
|
26368d096723
Datasheet validation, better repartition of js function, hand cursor on buttons.
cavaliet
parents:
32
diff
changeset
|
363 |
valid_req = 1 |
|
26368d096723
Datasheet validation, better repartition of js function, hand cursor on buttons.
cavaliet
parents:
32
diff
changeset
|
364 |
if len(same_organisation_ds)>0 : |
|
26368d096723
Datasheet validation, better repartition of js function, hand cursor on buttons.
cavaliet
parents:
32
diff
changeset
|
365 |
return redirect('list_for_orga', orga_id=ds.organisation.id, valid=valid_req) |
|
26368d096723
Datasheet validation, better repartition of js function, hand cursor on buttons.
cavaliet
parents:
32
diff
changeset
|
366 |
else : |
|
26368d096723
Datasheet validation, better repartition of js function, hand cursor on buttons.
cavaliet
parents:
32
diff
changeset
|
367 |
return redirect('home') |
|
26368d096723
Datasheet validation, better repartition of js function, hand cursor on buttons.
cavaliet
parents:
32
diff
changeset
|
368 |
|
| 36 | 369 |
|
370 |
#@login_required |
|
371 |
def update_tag_alias(request): |
|
372 |
# 2 cases : |
|
373 |
# - ordered tag for one datasheet : POST["datasheet_id"] is not null |
|
374 |
# - all tags list : POST["datasheet_id"] is null and POST["num_page"] and POST["nb_by_page"] are not null |
|
375 |
tag_id = request.POST["id"] |
|
376 |
tag_alias = request.POST["value"] |
|
377 |
tag = Tag.objects.get(id=tag_id) |
|
378 |
tag.alias = tag_alias |
|
379 |
tag.save() |
|
380 |
||
381 |
if u"datasheet_id" in request.POST : |
|
382 |
return get_tag_table(request=request, ds_id=request.POST["datasheet_id"], valid=0) |
|
383 |
else : |
|
384 |
return get_all_tags_table(request=request, num_page=request.POST["num_page"], nb_by_page=request.POST["nb_by_page"]) |
|
385 |
||
|
44
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
386 |
|
| 46 | 387 |
#@login_required |
388 |
def get_categories(): |
|
389 |
# List of categories in an OrderedDict |
|
390 |
categories = OrderedDict({"":""}) |
|
391 |
for c in TagCategory.objects.order_by('label') : |
|
392 |
categories.update({c.label:c.label}) |
|
393 |
return categories |
|
|
44
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
394 |
|
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
395 |
|
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
396 |
#@login_required |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
397 |
def update_tag_category(request): |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
398 |
|
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
399 |
tag_id = request.POST["id"] |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
400 |
cat = request.POST["value"] |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
401 |
tag = Tag.objects.get(id=tag_id) |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
402 |
if cat and cat != "" : |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
403 |
tag.category = TagCategory.objects.get(label=cat) |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
404 |
else : |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
405 |
tag.category = None |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
406 |
tag.save() |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
407 |
# This function is available only in all_tags_table context |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
408 |
return get_all_tags_table(request=request, num_page=request.POST["num_page"], nb_by_page=request.POST["nb_by_page"]) |
|
244d805b4921
Reorder taggedsheet by drag and drop. Remove wikipedia_activated for a tag. TagCategory chosen by closed list.
cavaliet
parents:
43
diff
changeset
|
409 |
|
| 36 | 410 |