Simply add context related links to your Django views.
Project description
Django Context-Actions
Quickly link to other pages of your django application.
Features
- Simple definition of links to other pages
- Static or dynamic definition of ContextActions
- Filters out links to views that the user is not allowed to access
- Automatically uses the most recent
nextparameter of GET queries
Setup
from django.utils.translation import gettext_lazy as _
from django.views.generic import TemplateView
from contextactions.contextactions import ContextAction
from contextactions.mixins import ContextActionsMixin
class MyView(
ContextActionsMixin,
TemplateView,
):
context_actions = [
ContextAction(
name='my_app:my_view',
label=_('my human readable translated link text'),
),
]
template_name = 'my_template.html'
In your template include the provided context actions template…
{% include 'contextactions/contextactions.html' %}
or implement you own using view.get_context_actions
{% for action in view.get_context_actions %}
<a href="{% if action.url %}{{ action.url }}{% else %}{% url action.name %}{% endif %}">{% if action.label %}{{ action.label }}{% else %}{{ action.url }}{% endif %}</a>
{% endfor %}
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file djangocontextactions-0.0.7.tar.gz.
File metadata
- Download URL: djangocontextactions-0.0.7.tar.gz
- Upload date:
- Size: 16.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7778bc51104e31b88b64264096ac4f7f97df547d4621bb61b32a5299bd20dd1f
|
|
| MD5 |
22cc1239ff7d1d5369ab362dc24803d8
|
|
| BLAKE2b-256 |
72574dec385f728f194ecefa7595e20f0b027764e0d83bffd23488e394383672
|
File details
Details for the file djangocontextactions-0.0.7-py3-none-any.whl.
File metadata
- Download URL: djangocontextactions-0.0.7-py3-none-any.whl
- Upload date:
- Size: 20.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b96bc93eed0061335166c1872567f5de07e69427e611481cc021e41ec1ab2f77
|
|
| MD5 |
a78293f0b5972d80356c421a00b69c5d
|
|
| BLAKE2b-256 |
ceaeb95d5c13a3e3cd4c6d62bb043c2b40c0b7df3b6e000809db87033c5fe83a
|