Skip to content
GitLab
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
6d5958a6
Commit
6d5958a6
authored
Nov 04, 2011
by
stef
Browse files
[enh] added legend to map on view
parent
af1e9241
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
bt/views.py
View file @
6d5958a6
...
...
@@ -214,13 +214,16 @@ def list_violations(request):
countries
=
sorted
([(
i
[
'total'
],
i
[
'country'
])
for
i
in
Violation
.
objects
.
values
(
'country'
).
filter
(
activationid
=
''
).
annotate
(
total
=
Count
(
'country'
))],
reverse
=
True
)
countries
=
json
.
dumps
(
dict
([(
c
.
lower
(),
"#ff%x00"
%
(
3
*
int
(
64
*
(
float
(
w
)
/
countries
[
0
][
0
]))
+
63
))
for
w
,
c
in
countries
]))
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
]))
#confirms=sorted([(i['total'],i['country'])
# for i in Violation.objects.values('country').filter(activationid='').annotate(total=Count('confirmation'))],
# reverse=True)
return
render_to_response
(
'list.html'
,
{
"violations"
:
violations
,
"countries"
:
countries
,},
"countries"
:
dict
([(
y
,
x
)
for
x
,
y
in
countries
]),
"countrycolors"
:
countrycolors
,
"legend"
:
legend
,},
#"confirms": confirms,},
context_instance
=
RequestContext
(
request
))
...
...
media/css/style.css
View file @
6d5958a6
...
...
@@ -625,4 +625,7 @@ ul.messages {
#similar_cases
li
{
list-style
:
disc
inside
;
margin-left
:
0.3em
;
color
:
black
;
}
.mceToolbar
{
display
:
none
;
}
\ No newline at end of file
.mceToolbar
{
display
:
none
;
}
#legend
{
text-align
:
center
;
margin-bottom
:
.5em
;
font-size
:
.7em
;
}
#legend
li
{
padding
:
.1em
;
display
:
inline
;
}
#map
{
float
:
right
;
}
templates/list.html
View file @
6d5958a6
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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