Skip to main content

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

dproj

settings_reuse

In your own project settings, use like so:

from djinntoux.dproj.settings_reuse import *  # noqa

...

INSTALLED_APPS = BASE_APPS + []

urls_reuse

In your project root URLconf, use like so:

urlpatterns = [
    path('', include('djinntoux.dproj.urls_reuse')),
    ...
]

Abstract Models

As an example in a models.py file:

from djinntoux.abstract import EditLink, Timestamps, UUIDpk7

...

class Account(Timestamps, EditLink):

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'

The main app files are mostly copied verbatim from upstream, tweaked to replace the stock first_name and last_name conventions from upstream with slightly more international options, lightly inspired by the Cookiecutter Django project.

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

djinntoux-0.0.2.tar.gz (15.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

djinntoux-0.0.2-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file djinntoux-0.0.2.tar.gz.

File metadata

  • Download URL: djinntoux-0.0.2.tar.gz
  • Upload date:
  • Size: 15.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.1

File hashes

Hashes for djinntoux-0.0.2.tar.gz
Algorithm Hash digest
SHA256 46b9d271ebfa3726496801e5c6b6905e0fb1e1dee22662b4e76e499b21ac51af
MD5 1f89a24ed00b3232682292d5c9fdc5b4
BLAKE2b-256 620d306f5690cb7ee2d129bae89b8aa0aa03da67581188c6bfabe00329509614

See more details on using hashes here.

File details

Details for the file djinntoux-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: djinntoux-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 17.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.1

File hashes

Hashes for djinntoux-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 76c961f6e4998c9c934af59a621fe82ba1343153a49cb79b247d246df626c0f3
MD5 20db10a6791f835bff719c770f12d6f5
BLAKE2b-256 6f9b3c0ebc66ac355c957c3d15eb2bc94af58dda7d764674716a41b9f7681e09

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page