Boilerplate tools for python based projects.
src/ktools | ||
.gitignore | ||
.isort.cfg | ||
__init__.py | ||
LICENSE | ||
pyproject.toml | ||
README.md | ||
setup.py |
Ktools
This module contains boilerplate for python projects, mostly based on django.
Contents
Django
ktools.django.db.models.fields.PositiveAutoField
A mysql-based AutoField
that will use an UNSIGNED INT
for a primary field.
Use this in django's settings.py
:
DEFAULT_AUTO_FIELD = 'ktools.django.db.models.fields.PositiveAutoField'
Cache
ktools.cache.functional.memoized_method
A decorator to cache return values of a method (of a class) until the class is used. Parameters are that of lru_cache()
since it uses that function under the hood.
ktools.django.utils.text.slugify
Function to return an ASCII-safe slugified string from any utf-8 string.