DEPRECATED. This approach causes more headaches than it's worth.
django_page_visibility
This package implements a standard protocol allowing developers to ask "can user X currently access page Y?".
Rather than duplicating the permission checks performed in that view, you ask the view itself whether or not the user can access it.
Conforming Views
Conforming views must implement a .test_page_visibilty(request, *args, **kwargs) method. This will be called with the same args and kwargs that the actual view would be called with.
This method must return a truthy value if the user can access the page, and False otherwise. It may also raise an exception, to indicate that the user cannot access the page. See PAGE_VISIBILITY_EXCEPTIONS below.
The Test Function
Developers can call django_page_visibility.is_visible_to_user(path, user) (see the code for details) to test visibility. Or, in a template, you can use our is_permitted_to_see filter or permitted_link tag.
PAGE_VISIBILITY_EXCEPTIONS setting
By default, we return False if either django.http.Http404 or django.core.exceptions.PermissionDenied are raised. You can override this by setting (in your django settings) PAGE_VISIBILITY_EXCEPTIONS to a list of exception classes.
We expect most users to override this setting. For example, if you are using exceptional_auth and django_early_return, then you'll want to set:
PAGE_VISIBILITY_EXCEPTIONS = [
'django.core.exceptions.PermissionDenied',
'django.http.Http404',
'django_early_return.EarlyReturn',
'exceptional_auth.AuthException',
]
Metadata
Release files for django-page-visibility 0.3.0
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 | |
|---|---|---|---|---|
| django_page_visibility-0.3.0.tar.gz | 6.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_page_visibility-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.9 kB
Release files / django_page_visibility-0.3.0.tar.gz
| Download URL | django_page_visibility-0.3.0.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
122d3fe8bd3ac7098fc86497c77510e41432ffd8c1aabdbf0dfbc5714f471057
|
|
BLAKE2b-256 checksum How to use checksums |
59d5e064d9cf3fae703afb28d8fc78a4ec7d1e392f4b04381e1b087e964b517f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.9.6 readme-renderer/34.0 requests/2.26.0 requests-toolbelt/0.10.1 urllib3/1.26.7 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.15
|
Release files / django_page_visibility-0.3.0-py3-none-any.whl
| Download URL | django_page_visibility-0.3.0-py3-none-any.whl |
|---|---|
| Size | 11.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
708ae5cba8b0642384fcfc8de88e18dcd190183e452d8e80ffc298c214517235
|
|
BLAKE2b-256 checksum How to use checksums |
ee5e14638d1fb41041a7a78bc9263647234c134f0a098233f6ded65f11a6a478
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.9.6 readme-renderer/34.0 requests/2.26.0 requests-toolbelt/0.10.1 urllib3/1.26.7 tqdm/4.64.1 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.5 CPython/3.6.15
|
Security for django-page-visibility 0.3.0
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.