py-ktools/README.md

28 lines
709 B
Markdown
Raw Permalink Normal View History

2023-05-13 18:47:44 +02:00
# Ktools
This module contains boilerplate for python projects, mostly based on django.
## Contents
### Django
2023-05-21 17:55:58 +02:00
#### `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'
```
2023-05-21 17:39:53 +02:00
### 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.
2023-05-21 17:55:58 +02:00
#### `ktools.django.utils.text.slugify`
Function to return an ASCII-safe slugified string from any utf-8 string.