Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
Respect My Net
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
piks3l
Respect My Net
Commits
79bfa861
Commit
79bfa861
authored
Nov 11, 2011
by
Cynddl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changes from origin branch
parent
19f30733
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
66 additions
and
46 deletions
+66
-46
bt/models.py
bt/models.py
+3
-2
bt/views.py
bt/views.py
+15
-3
media/css/style.css
media/css/style.css
+4
-1
templates/list.html
templates/list.html
+38
-34
templates/view.html
templates/view.html
+5
-6
urls.py
urls.py
+1
-0
No files found.
bt/models.py
View file @
79bfa861
...
...
@@ -13,6 +13,7 @@ COUNTRIES = (
(
'EL'
,
_
(
'Greece'
)),
(
'ES'
,
_
(
'Spain'
)),
(
'FR'
,
_
(
'France'
)),
(
'IS'
,
_
(
'Iceland'
)),
(
'IT'
,
_
(
'Italy'
)),
(
'CY'
,
_
(
'Cyprus'
)),
(
'LV'
,
_
(
'Latvia'
)),
...
...
@@ -30,8 +31,7 @@ COUNTRIES = (
(
'SK'
,
_
(
'Slovakia'
)),
(
'FI'
,
_
(
'Finland'
)),
(
'SE'
,
_
(
'Sweden'
)),
(
'UK'
,
_
(
'United Kingdom '
)),
(
'NO'
,
_
(
'Norway'
)),
(
'UK'
,
_
(
'United Kingdom'
)),
)
RESOURCES
=
(
...
...
@@ -91,6 +91,7 @@ class Comment(models.Model):
class
Attachment
(
models
.
Model
):
storage
=
models
.
FileField
(
upload_to
=
'static'
)
name
=
models
.
CharField
(
max_length
=
512
)
type
=
models
.
CharField
(
max_length
=
512
)
comment
=
models
.
ForeignKey
(
Comment
)
class
Admin
:
...
...
bt/views.py
View file @
79bfa861
...
...
@@ -3,6 +3,7 @@ from django.http import HttpResponse, HttpResponseRedirect, Http404
from
django.shortcuts
import
render_to_response
,
get_object_or_404
from
django.template
import
RequestContext
from
django.core.files
import
File
from
django.core.servers.basehttp
import
FileWrapper
from
django.conf
import
settings
from
django.core.paginator
import
Paginator
,
EmptyPage
,
PageNotAnInteger
from
django.core.exceptions
import
ObjectDoesNotExist
...
...
@@ -163,7 +164,7 @@ def add(request):
)
c
.
save
()
for
f
in
request
.
FILES
.
getlist
(
'attachments[]'
):
a
=
Attachment
(
comment
=
c
,
name
=
f
.
name
)
a
=
Attachment
(
comment
=
c
,
name
=
f
.
name
,
type
=
f
.
content_type
)
m
=
hashlib
.
sha256
()
for
chunk
in
f
.
chunks
():
m
.
update
(
chunk
)
...
...
@@ -213,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
))
...
...
@@ -229,6 +233,14 @@ def view(request,id):
raise
Http404
return
render_to_response
(
'view.html'
,
{
'v'
:
v
,
},
context_instance
=
RequestContext
(
request
))
def
get_attach
(
request
,
id
):
f
=
get_object_or_404
(
Attachment
,
pk
=
id
)
wrapper
=
FileWrapper
(
f
.
storage
)
response
=
HttpResponse
(
wrapper
,
mimetype
=
f
.
type
)
response
[
'Content-Disposition'
]
=
'attachment; filename="%s"'
%
f
.
name
response
[
'Content-Length'
]
=
f
.
storage
.
size
return
response
def
lookup
(
request
):
if
request
.
method
==
'GET'
:
form
=
SearchViolation
(
request
.
GET
)
...
...
media/css/style.css
View file @
79bfa861
...
...
@@ -661,4 +661,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 @
79bfa861
This diff is collapsed.
Click to expand it.
templates/view.html
View file @
79bfa861
...
...
@@ -79,7 +79,6 @@ $(document).ready(function() {
{%block content%}
<div
id=
'global'
>
<h2>
{{v.operator}} ({{v.country}}) {{v.contract}}
</h2>
<div
id=
"report"
>
<div
id=
"icons"
>
<span
id=
"verified_tooltip"
class=
"tooltip"
>
{% trans "This case was verified by the management team" %}
</span>
...
...
@@ -89,11 +88,11 @@ $(document).ready(function() {
<span
id=
"invalidations"
>
{%if v.invalidations %} {{v.invalidations}} {%else%} 0 {%endif%}
</span>
</div>
<dl>
{%if v.resource_name%}
<dt>
{% trans "
R
esource" %}
</dt><dd>
{{v.resource_name}}
</dd>
{%endif%}
<dl>
{%if v.resource_name%}
<dt>
{% trans "
Affected r
esource" %}
</dt><dd>
{{v.resource_name}}
</dd>
{%endif%}
{%if v.type%}
<dt>
{% trans "Type" %}
</dt><dd>
{{v.type}}
</dd>
{%endif%}
{%if v.media%}
<dt>
{% trans "Media" %}
</dt><dd>
{{v.media}}
</dd>
{%endif%}
{%if v.temporary%}
<dt>
{% trans "Temporary restriction" %}
</dt><dd>
{{v.temporary}}
</dd>
{%endif%}
{%if v.loophole%}
<dt>
{% trans "
Loophole offering
" %}
</dt><dd>
{% trans "yes" %}
</dd>
{%endif%}
{%if v.loophole%}
<dt>
{% trans "
Another offer provided by the same operator removes this restriction
" %}
</dt><dd>
{% trans "yes" %}
</dd>
{%endif%}
{%if v.contractual%}
<dt>
{% trans "Contractual restriction" %}
</dt><dd>
{% trans "yes" %}
</dd>
{%endif%}
{%if v.contract_excerpt%}
<dt>
{% trans "Contract excerpt" %}
</dt><dd
class=
'text'
>
{{v.contract_excerpt|safe}}
</dd>
{%endif%}
{%if v.comment_set.all%}
</dl>
...
...
@@ -108,7 +107,7 @@ $(document).ready(function() {
<h4>
{% trans "Attachments" %}
</h4>
<ul>
{%for a in c.attachment_set.all%}
<li><a
href=
"
{%media_url%}/{{a.storage.url
}}"
>
{{a.name}}
</a></li>
<li><a
href=
"
/attach/{{a.id
}}"
>
{{a.name}}
</a></li>
{%endfor%}
</ul>
</div>
...
...
@@ -136,8 +135,8 @@ $(document).ready(function() {
{% get_comment_list for v as cmt_list %}
{% for comment in cmt_list %}
<div
class=
"comment"
>
<p>
<a
href=
"{{ comment.user_url }}"
>
{{ comment.user_name }}
</a>
- {{ comment.submit_date }}
</p>
<p>
{{ comment.comment }}
</p>
<p>
{{ comment.user_name }}
- {{ comment.submit_date }}
</p>
<p>
{{ comment.comment
|striptags|urlize|linebreaks
}}
</p>
</div>
{% endfor %}
<div
class=
"toggle button"
>
{% trans "Add comment" %}
</div>
...
...
urls.py
View file @
79bfa861
...
...
@@ -15,6 +15,7 @@ urlpatterns = patterns('',
(
r
'^ajax/(?P<country>[^/]*)(/(?P<operator>[^/]*))?$'
,
bt
.
ajax
),
(
r
'^add/$'
,
bt
.
add
),
(
r
'^view/(?P<id>[0-9]*)$'
,
bt
.
view
),
(
r
'^attach/(?P<id>[0-9]*)$'
,
bt
.
get_attach
),
(
r
'^(?P<id>[0-9]*)$'
,
bt
.
view
),
(
r
'^rss/$'
,
RssSiteNewsFeed
()),
(
r
'^atom/$'
,
AtomSiteNewsFeed
()),
...
...
Write
Preview
Markdown
is supported
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