2019-05-21 15:30:51 +02:00
|
|
|
"""
|
|
|
|
Les converters sont la méthode "clean" de faire les regex custom dans des URLs django.
|
|
|
|
Plus d'info dans la doc :
|
|
|
|
https://docs.djangoproject.com/en/2.2/topics/http/urls/#registering-custom-path-converters
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
2019-04-12 17:06:53 +02:00
|
|
|
class TrigrammeConverter:
|
|
|
|
regex = ".{3}"
|
|
|
|
|
|
|
|
def to_python(self, value):
|
|
|
|
return str(value)
|
|
|
|
|
|
|
|
def to_url(self, value):
|
|
|
|
return str(value)
|