dj3base
English | 简体中文
dj3base contains some small tools for Django.
1. Introduction
admin: UseOrderedAdminSiteto customize the order of apps and models.views: UsePostJsonViewto handle POST-JSON-style requests.utils: Some utility functions.
2. Usage
Install
pip install dj3base
Examples
- OrderedAdminSite
from django.contrib.auth.models import User, Group
from django.contrib.auth.admin import UserAdmin, GroupAdmin
from django.contrib.auth.apps import AppConfig
from dj3base.admin.ordered_admin_site import OrderedAdminSite
class MyAdminSite(OrderedAdminSite):
ordered_apps = {
AppConfig: {
"index": 1,
"models": {
Group: {"index": 1},
User: {"index": 2},
}
}
}
my_admin_site = OrderedAdminSite(name='my_admin')
my_admin_site.register(User, UserAdmin)
my_admin_site.register(Group, GroupAdmin)
# in urls.py
from django.urls import path
urlpatterns = [
path('admin/', my_admin_site.urls),
]
- PostJsonView
from dj3base.views import PostJsonView
from a3json_struct import struct
class RequestStruct(struct.JsonStruct):
message: str = struct.CharField(min_length=1, max_length=10)
class EchoView(PostJsonView):
request_struct_cls = RequestStruct
def handle_post(self, request_struct: RequestStruct, custom_params: dict) -> dict:
return {"message": f"hello {request_struct.message}"}
Metadata
Release files for dj3base 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dj3base-0.3.1.tar.gz | 9.9 kB | Without provenance | Details for dj3base-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dj3base-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for dj3base-0.3.1-py3-none-any.whl |
Total release size: 22.9 kB
Release files / dj3base-0.3.1.tar.gz
| Download URL | dj3base-0.3.1.tar.gz |
|---|---|
| Size | 9.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bd5dff83cc40ab11a85da58056409d3a9d7227fdef30c69250dff0b0820e270f
|
|
BLAKE2b-256 checksum How to use checksums |
f0383eb9c05ee4ddf24a4c810a9a996be851d81aaf6662aa39c340c62fc2b4ae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.2
|
Release files / dj3base-0.3.1-py3-none-any.whl
| Download URL | dj3base-0.3.1-py3-none-any.whl |
|---|---|
| Size | 13.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
413a615e7c772e06cdffd61734d0e34a27bb3023d48d373c40820a5f09b02b31
|
|
BLAKE2b-256 checksum How to use checksums |
cdb53e946f0ba7b288069ddbff89ac9e8f8d7997480eed3384373a09206b5a6a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.2
|
Security for dj3base 0.3.1
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.