No project description provided
Project description
Utils module (dnoticias.pt)
Django package used in subscriptions, editions, comments and mail system. This package has the most common functions used in every project, like http error handlers, delete functions, checkers, etc.
Views
Select2View
View used to construct the select2 inputs data
To make this view works, you will need to replace this attrs:
Attribute | Description |
---|---|
SEARCH_PARAMS | The model attribute you will search for. I.e: Name, dni, etc |
SEARCH_TYPE | Django search type (icontains, lte, gte, etc) |
ORDER_BY_PARAMS | The model attribute you will order for |
MODEL | Model used in the input |
MODEL_VERBOSE_NAMES | Input name |
GenericDeleteView
View used to delete an object from database.
LivenessCheckView
This view is used to do the liveness check. This will check the following things:
- Database connection
- Homepage load (optional)
And, in case of failure, will send an email (if configured) to the DEFAULT_IT_EMAIL.
Setting | Type | Description |
---|---|---|
DEFAULT_IT_EMAIL | String | Email address that will be notified in case of failure |
EMAIL_TEMPLATE_LIVENESS_FAIL_UUID | String | Email template UUID |
LIVENESS_CHECK_HOMEPAGE | Boolean | Check homepage? |
LIVENESS_SEND_EMAIL_ON_FAILURE | Boolean | Send email on failure? |
LIVENESS_CACHE_NAME | String | Cache cooldown name |
LIVENESS_EMAIL_COOLDOWN | String | Cache cooldown time |
In case of having middleware (yes), you will need to add the liveness check url to the OIDC_EXEMPT_URLS and AUTH_EXEMPT_URLS regex list
re.compile(r'(?:\/check\/health)(.*)'),
And now, remember to add the liveness to the main path urls.py
from django.urls import path
...
from dnoticias_utils.views import LivenessCheckView
...
urlpatterns = [
...
# Liveness check url
path('check/health/', LivenessCheckView.as_view(), name="liveness-check"),
]
Error views (error_views.py)
This file contains functions to handle the different http errors. Instead of use different views in html, we have only one view with context.
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
File details
Details for the file django_dnoticias_utils-1.8.1.tar.gz
.
File metadata
- Download URL: django_dnoticias_utils-1.8.1.tar.gz
- Upload date:
- Size: 40.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 97c899ab7a3b775976e88a4014435738e57a3861be64234b8507ed69b83bc323 |
|
MD5 | cd7a51679ee7189e5a2ad3644a777514 |
|
BLAKE2b-256 | 64a61cb643efb407041c6d2463a8b63480c75c619d2fd3b1d160e825d5f1c303 |