Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
La Quadrature du Net
Respect My Net
Commits
5260978b
Commit
5260978b
authored
Nov 22, 2011
by
Baptiste Jonglez
Browse files
[enh] merge 'closed' and 'ooscope' (#44)
parent
fb21945b
Changes
2
Show whitespace changes
Inline
Side-by-side
bt/models.py
View file @
5260978b
...
@@ -53,7 +53,6 @@ MEDIA = (
...
@@ -53,7 +53,6 @@ MEDIA = (
STATUS
=
(
STATUS
=
(
(
'new'
,
_
(
'New'
)),
(
'new'
,
_
(
'New'
)),
(
'duplicate'
,
_
(
'Duplicate'
)),
(
'duplicate'
,
_
(
'Duplicate'
)),
(
'closed'
,
_
(
'Closed'
)),
(
'verified'
,
_
(
'Verified'
)),
(
'verified'
,
_
(
'Verified'
)),
(
'moreinfo'
,
_
(
'Need more info'
)),
(
'moreinfo'
,
_
(
'Need more info'
)),
(
'ooscope'
,
_
(
'Out of scope'
)),
(
'ooscope'
,
_
(
'Out of scope'
)),
...
...
bt/views.py
View file @
5260978b
...
@@ -194,16 +194,16 @@ def index(request):
...
@@ -194,16 +194,16 @@ def index(request):
v_list
=
Violation
.
objects
.
filter
(
activationid
=
''
,
featuredcase__isnull
=
False
).
order_by
(
'id'
).
reverse
()[:
3
]
v_list
=
Violation
.
objects
.
filter
(
activationid
=
''
,
featuredcase__isnull
=
False
).
order_by
(
'id'
).
reverse
()[:
3
]
form
=
AddViolation
()
form
=
AddViolation
()
reports
=
sorted
([(
i
[
'total'
],
i
[
'id'
])
reports
=
sorted
([(
i
[
'total'
],
i
[
'id'
])
for
i
in
Violation
.
objects
.
values
(
'id'
).
filter
(
activationid
=
''
).
exclude
(
state
=
[
'ooscope'
,
'closed'
,
'duplicate'
]).
annotate
(
total
=
Count
(
'confirmation'
))],
for
i
in
Violation
.
objects
.
values
(
'id'
).
filter
(
activationid
=
''
).
exclude
(
state
=
[
'ooscope'
,
'duplicate'
]).
annotate
(
total
=
Count
(
'confirmation'
))],
reverse
=
True
)
reverse
=
True
)
# countries=sorted([(i['total'],i['country'])
# countries=sorted([(i['total'],i['country'])
# for i in Violation.objects.values('country').filter(activationid='').annotate(total=Count('country'))],
# for i in Violation.objects.values('country').filter(activationid='').annotate(total=Count('country'))],
# reverse=True)
# reverse=True)
confirms
=
sorted
([(
i
[
'total'
],
i
[
'country'
])
confirms
=
sorted
([(
i
[
'total'
],
i
[
'country'
])
for
i
in
Violation
.
objects
.
values
(
'country'
).
filter
(
activationid
=
''
).
exclude
(
state
=
[
'ooscope'
,
'closed'
,
'duplicate'
]).
annotate
(
total
=
Count
(
'confirmation'
))],
for
i
in
Violation
.
objects
.
values
(
'country'
).
filter
(
activationid
=
''
).
exclude
(
state
=
[
'ooscope'
,
'duplicate'
]).
annotate
(
total
=
Count
(
'confirmation'
))],
reverse
=
True
)
reverse
=
True
)
operators
=
sorted
([(
i
[
'total'
],
i
[
'operator'
])
operators
=
sorted
([(
i
[
'total'
],
i
[
'operator'
])
for
i
in
Violation
.
objects
.
values
(
'operator'
).
filter
(
activationid
=
''
).
exclude
(
state
=
[
'ooscope'
,
'closed'
,
'duplicate'
]).
annotate
(
total
=
Count
(
'confirmation'
))],
for
i
in
Violation
.
objects
.
values
(
'operator'
).
filter
(
activationid
=
''
).
exclude
(
state
=
[
'ooscope'
,
'duplicate'
]).
annotate
(
total
=
Count
(
'confirmation'
))],
reverse
=
True
)
reverse
=
True
)
return
render_to_response
(
return
render_to_response
(
...
@@ -228,7 +228,7 @@ def filter_violations(request, country, operator=None):
...
@@ -228,7 +228,7 @@ def filter_violations(request, country, operator=None):
def
list_violations
(
request
):
def
list_violations
(
request
):
violations
=
Violation
.
objects
.
filter
(
activationid
=
''
)
violations
=
Violation
.
objects
.
filter
(
activationid
=
''
)
countries
=
sorted
([(
i
[
'total'
],
i
[
'country'
])
countries
=
sorted
([(
i
[
'total'
],
i
[
'country'
])
for
i
in
Violation
.
objects
.
values
(
'country'
).
filter
(
activationid
=
''
).
exclude
(
state
=
[
'duplicate'
,
'ooscope'
,
'closed'
]).
annotate
(
total
=
Count
(
'country'
))],
for
i
in
Violation
.
objects
.
values
(
'country'
).
filter
(
activationid
=
''
).
exclude
(
state
=
[
'duplicate'
,
'ooscope'
]).
annotate
(
total
=
Count
(
'country'
))],
reverse
=
True
)
reverse
=
True
)
legend
=
sorted
(
set
([(
w
,
"rgba(255,%d, 00, 0.4)"
%
(
w
*
768
/
(
countries
[
0
][
0
]
+
1
)
%
256
))
for
w
,
c
in
countries
]),
reverse
=
True
)
legend
=
sorted
(
set
([(
w
,
"rgba(255,%d, 00, 0.4)"
%
(
w
*
768
/
(
countries
[
0
][
0
]
+
1
)
%
256
))
for
w
,
c
in
countries
]),
reverse
=
True
)
countrycolors
=
json
.
dumps
(
dict
([(
c
.
lower
(),
"#ff%02x00"
%
(
w
*
768
/
(
countries
[
0
][
0
]
+
1
)
%
256
))
for
w
,
c
in
countries
]))
countrycolors
=
json
.
dumps
(
dict
([(
c
.
lower
(),
"#ff%02x00"
%
(
w
*
768
/
(
countries
[
0
][
0
]
+
1
)
%
256
))
for
w
,
c
in
countries
]))
...
...
Write
Preview
Supports
Markdown
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