Generic reusable bits for Django projects
Project description
djinntoux
Generic reusable bits for Django projects
Disclaimer
This package is only intended for my own personal use, install at your own risk
Rebuild
Assumes twine is installed and an API token is stored in a .pypirc file:
rm -rfv dist/ && python -m build && twine upload --verbose dist/*
Installation
pip install djinntoux
Usage
Abstract Models
As an example in a models.py file:
from djinntoux.abstract import EditLink, Timestamps, UUIDpk7
EditLink
Set ADMIN_PATH in project settings (do not add a leading slash), e.g. to keep the Django default path without using an environment variable:
ADMIN_PATH = 'admin/'
Then in templates you can use like so:
<a target="_blank" href="{{ obj.get_edit_path }}">Edit</a>
Custom Users App
In project settings add djinntoux.users to INSTALLED_APPS and set AUTH_USER_MODEL = 'zy_users.User'
Renames
In project settings make sure INSTALLED_APPS reflects something akin to this:
'djinntoux.renames.AuthRenamedConfig',
# 'django.contrib.auth',
# https://docs.djangoproject.com/en/dev/ref/contrib/sites/
# 'django.contrib.sites',
'djinntoux.renames.SitesRenamedConfig',
Scraping
from djinntoux.scraping import get_host_and_title
Then use like so:
def save(self, *args, **kwargs):
if not self.link_title:
self.link_title = get_host_and_title(self)[1]
super(Link, self).save(*args, **kwargs)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file djinntoux-0.0.1.tar.gz.
File metadata
- Download URL: djinntoux-0.0.1.tar.gz
- Upload date:
- Size: 13.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
846dc423b1d50b0a0fd235c499b314e8ceb7c7fbf6917a08a28e5bab1129ea9a
|
|
| MD5 |
6c03a036189c2fb2b99ee22e81db5289
|
|
| BLAKE2b-256 |
22f628d9fcccf5277685f80c615bd7e3c5ac2930297d7fddc1aacceb36bcd008
|
File details
Details for the file djinntoux-0.0.1-py3-none-any.whl.
File metadata
- Download URL: djinntoux-0.0.1-py3-none-any.whl
- Upload date:
- Size: 15.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2cbb9aeab1e6806ac7668507089ea7d522ddf9f88542b7b277b63b6b6c22b7c
|
|
| MD5 |
969afc2e88f173e18c22cd8b69ac2900
|
|
| BLAKE2b-256 |
ad180c60721fc08170e7358c650f86870998e5d66488684704d9393072a65001
|