Parent
ae48d9ae4e
révision
338a108faa
|
@ -9,10 +9,10 @@ class PostalCode:
|
|||
regex = r'[0-9]{5}'
|
||||
|
||||
def to_python(self, value):
|
||||
return int(value)
|
||||
return value
|
||||
|
||||
def to_url(self, value):
|
||||
return '%05d' % value
|
||||
return value
|
||||
|
||||
|
||||
register_converter(PostalCode, 'postal')
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
import json
|
||||
import os
|
||||
import sqlite3
|
||||
|
||||
from django.conf import settings
|
||||
from django.http import HttpResponse
|
||||
|
||||
|
||||
def index(request, **kwargs):
|
||||
c = sqlite3.connect(settings.BASE_DIR + '/cp/laposte_hexasmal.db').cursor()
|
||||
db_path = os.path.dirname(__file__)
|
||||
c = sqlite3.connect(db_path + '/laposte_hexasmal.db').cursor()
|
||||
|
||||
c.execute('SELECT * FROM cp WHERE code = "{}";'.format(kwargs['code']))
|
||||
rows = c.fetchall()
|
||||
search = request.GET.get('search', '')
|
||||
|
|
Chargement…
Référencer dans un nouveau ticket