Skip to main content

Django TinyUser

Neither the app nor the documentation is finished yet, but I wanted to publish the project anyway, because I need it for my projects and I want to share it with others. If you want to contribute to the project, feel free to open a pull request or an issue.

Django TinyUser is a small user authentication app for django. It is meant to be used by projects that need a small user authentication for their projects and don't want to implement their own. It is used by my projects and docker images for basic user authentication using django-allauth.

This project is distributed under the 0BSD-License.

It uses django-allauth as backend and overloads the templates for Bootstrap and Tailwind CSS.

Installation

Add TinyUser to your project using poetry

poetry add https+git://codeberg.org/c9moser/django-tinyuser.git

Configuration of your project

from django_tinyuser.global_templates.tailwindcss import PATH as TINYUSER_GLOBAL_TEMPLATES
...
# Register allauth and django_tinyuser
APPS = [
    ...
    'allauth',
    'allauth.account',
    'allauth.socialaccount', # if you want to use social auth
    # add the providers you want to use, e.g. 'allauth.socialaccount.providers.google',
    'django_tinyuser',
    ...
]

If you use Bootstrap, you can add overloads to your TEMPLATES. The overloads are located in the global_templates folder of django_tinyuser. You can add them to your TEMPLATES like this is and they will be used instead of the default templates of django-allauth.

Note that you have to add the path to the overloads before the default templates of django-allauth, otherwise they will not be used.

And don't forget to add the context processors for django-allauth, and django-tinyuser otherwise the templates will not work.

from django_tinyuser.global_templates.bootstrap import PATH as TINYUSER_GLOBAL_TEMPLATES
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        # Add Bootstrap overloads to TEMPLATES
        'DIRS': [TINYUSER_GLOBAL_TEMPLATES],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                ...
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
                'django_tinyuser.context_processors.tinyuser'
                ...
            ],
        },
    },
...
]

If you use Tailwind CSS, you can add the overloads to your TEMPLATES like this is and they will be used instead of the default templates of django-allauth.

from django_tinyuser.global_templates.tailwindcss import PATH as TINYUSER_GLOBAL_TEMPLATES
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        # Add Tailwind CSS overloads to TEMPLATES
        'DIRS': [TINYUSER_GLOBAL_TEMPLATES],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                ...
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
                'django_tinyuser.context_processors.tinyuser'
                ...
            ],
        },
    },
...
]

You also need to set the CSS_FRAMEWORK option in your settings.py to the css framework you use, otherwise the templates will not work.

CSS_FRAMEWORK = 'bootstrap' # if you use Bootstrap
# or
CSS_FRAMEWORK = 'tailwindcss' # if you use Tailwind CSS
# or
CSS_FRAMEWORK = 'custom' # if you use custom templates

And you need to set the AUTH_USER_MODEL to django_tinyuser.TinyUser in your settings.py or to an overloaded model if you have customized the user model.

AUTH_USER_MODEL = 'django_tinyuser.TinyUser'

Then add the urls of django-allauth to your urls.py

from django.urls import path, include
urlpatterns = [
    ...
    path('accounts/', include('allauth.urls')),
    ...
]

Finally run the migrations to create the required tables added by required apps, django-allauth and django-tinyuser.

    python manage.py migrate

Configuration options to be added to your settings.py

CSS_FRAMEWORK

One of the following values:

  • bootstrap - if you use Bootstrap (partially implemented, but not tested yet)
  • tailwindcss - if you use Tailwind CSS (not implemented yet)
  • custom - custom template (you need to overload all templates yourself and add the path to your TEMPLATES)

Note that the default value is 'bootstrap', so if you use Bootstrap, you don't need to set this option.

If you use Tailwind CSS, you need to set this option to 'tailwindcss', otherwise the templates will not work.

You can contact me under my Mastodon account if you have any questions or suggestions for the project. I am also open for contributions, so if you want to contribute to the project, feel free to open a pull request or an issue.

Metadata

Release files for dj-tinyuser 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dj-tinyuser 0.0.3
File Size Uploaded Provenance Actions
dj_tinyuser-0.0.3.tar.gz 40.3 kB Without provenance Details for dj_tinyuser-0.0.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dj-tinyuser 0.0.3
File Interpreter ABI Platform Actions
dj_tinyuser-0.0.3-py3-none-any.whl Python 3 none any Details for dj_tinyuser-0.0.3-py3-none-any.whl

Total release size: 108.8 kB

Release files / dj_tinyuser-0.0.3.tar.gz

Download URL dj_tinyuser-0.0.3.tar.gz
Size 40.3 kB
Tags Source
SHA-256 checksum
How to use checksums
65c84af833f676e1c5f2a2737a3c872f100bed42a55d9ef78c7683d8e0a2caed
BLAKE2b-256 checksum
How to use checksums
29d367beb52848ccf4cf0e3c5c8ee84757433bf10071666d6667002812f76a9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.14.8 Linux/7.3.0-4-cachyos

Release files / dj_tinyuser-0.0.3-py3-none-any.whl

Download URL dj_tinyuser-0.0.3-py3-none-any.whl
Size 68.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9810d92cae00a5663084bc7f79d343daf1025ac69c3d126ff0e1cc0b5cd4402f
BLAKE2b-256 checksum
How to use checksums
fa78174dea96f3d6f8a620c4619b00062120b5991a1fceb44823eeba04cc138a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.14.8 Linux/7.3.0-4-cachyos

Security for dj-tinyuser 0.0.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page