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
piks3l
Respect My Net
Commits
32251f64
Commit
32251f64
authored
Apr 30, 2011
by
stef
Browse files
[enh] dynamic operator/contract lists from db enabled
parent
23f80053
Changes
1
Hide whitespace changes
Inline
Side-by-side
bt/views.py
View file @
32251f64
...
@@ -9,7 +9,7 @@ from django.core.exceptions import ObjectDoesNotExist
...
@@ -9,7 +9,7 @@ from django.core.exceptions import ObjectDoesNotExist
from
models
import
Violation
,
Attachment
,
Comment
from
models
import
Violation
,
Attachment
,
Comment
from
tempfile
import
mkstemp
from
tempfile
import
mkstemp
from
datetime
import
datetime
from
datetime
import
datetime
import
hashlib
,
os
,
re
import
hashlib
,
os
,
re
,
json
from
urlparse
import
urljoin
from
urlparse
import
urljoin
from
BeautifulSoup
import
BeautifulSoup
,
Comment
as
BComment
from
BeautifulSoup
import
BeautifulSoup
,
Comment
as
BComment
...
@@ -78,11 +78,9 @@ def add(request):
...
@@ -78,11 +78,9 @@ def add(request):
def
ajax
(
request
,
country
=
None
,
operator
=
None
):
def
ajax
(
request
,
country
=
None
,
operator
=
None
):
if
not
operator
:
if
not
operator
:
print
'c'
,
sorted
(
list
(
set
([
x
.
operator
for
x
in
Violation
.
objects
.
filter
(
country
=
country
)])))
return
HttpResponse
(
json
.
dumps
(
sorted
(
list
(
set
([
x
.
operator
for
x
in
Violation
.
objects
.
filter
(
country
=
country
)])))))
return
HttpResponse
(
'["Vodafone", "T-Mobile", "T-Home", "UPC Chello", "Orange"]'
)
else
:
else
:
print
'co'
,
sorted
(
list
(
set
([
x
.
operator
for
x
in
Violation
.
objects
.
filter
(
country
=
country
).
filter
(
operator
=
operator
)])))
return
HttpResponse
(
json
.
dumps
(
sorted
(
list
(
set
([
x
.
contract
for
x
in
Violation
.
objects
.
filter
(
country
=
country
).
filter
(
operator
=
operator
)])))))
return
HttpResponse
(
'["Basic", "Surfer", "Gamer", "Pro", "Business"]'
)
def
index
(
request
):
def
index
(
request
):
v_list
=
Violation
.
objects
.
all
()
v_list
=
Violation
.
objects
.
all
()
...
...
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