hotfix(cp): répare l autocompletion

pull/1/head v1.1.2
François Poulain 2019-12-19 16:20:29 +01:00 commité par François Poulain
Parent ae48d9ae4e
révision 338a108faa
2 fichiers modifiés avec 6 ajouts et 4 suppressions

Voir le fichier

@ -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')

Voir le fichier

@ -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', '')