
Product
Introducing Scala and Kotlin Support in Socket
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
django-admin-more-buttons
Advanced tools
Add more buttons with custom behavior to your django admin's submit line.
Add more buttons with custom behavior to your admin's submit line.
admin_buttons
to INSTALLED_APPS
:INSTALLED_APPS = [
...,
"admin_buttons",
]
ModelAdmin
, and define a admin_buttons_config
attribute:from admin_buttons.admin import AdminButtonsMixin
from django.contrib import admin
from django.db import models
from django.shortcuts import redirect
class SpecialModelAdmin[M: models.Model](AdminButtonsMixin, admin.ModelAdmin[M]):
"""
ModelAdmin for models that do something special. Their special thing
will be done upon the click of a button
"""
admin_buttons_config = [
{
# the button html name
"name": "_dosomethingspecial",
# the method to be called when clicking the button
"method": "do_something_special",
# The button label
"label": _("Do something very special"),
# Optionally, define a condition. If it does not pass, the
# button will not be displayed
"condition": lambda request, context: (
request.user.has_perm("someperm")
and not re.search(r"add/?$", request.path)
),
# Optionally, include extra html after the button
"extra_html": mark_safe_lazy(
'<input type="number" step=1 min=1 max=99 value=1 '
'name="n_times" aria-label="'
f'{_("Number of times do to something special")}">'
),
# Optionally, use a separator before this button:
use_separator: True,
},
]
# The chosen method works as a view. Therefore, it should return a response
# To simply return to the change view, redirect to HTTP_REFERER, as below:
def do_something_special(self, request: HttpRequest, obj: M | None):
obj.something_special()
return redirect(request.META["HTTP_REFERER"])
All contributions are welcome! To setup development:
pip install -r dev.requirements.txt
pre-commit install
FAQs
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports Scala and Kotlin, bringing AI-powered threat detection to JVM projects with easy manifest generation and fast, accurate scans.
Application Security
/Security News
Socket CEO Feross Aboukhadijeh and a16z partner Joel de la Garza discuss vibe coding, AI-driven software development, and how the rise of LLMs, despite their risks, still points toward a more secure and innovative future.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.