Commit 32251f64 authored by stef's avatar stef
Browse files

[enh] dynamic operator/contract lists from db enabled

parent 23f80053
...@@ -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()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment