Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
django-admin-extra-buttons
Advanced tools
This is a full rewriting of the original django-admin-extra-url
. It
provides decorators to easily add custom buttons to Django Admin pages and/or add views to any ModelAdmin
It allows easy creation of wizards, actions and/or links to external resources as well as api only views.
Four decorators are available:
button()
to mark a method as extra view and show related buttonlink()
This is used for "external" link, where you don't need to invoke local views.view()
View only decorator, this adds a new url but do not render any button.choice()
Menu like button, can be used to group multiple @views().
from admin_extra_buttons.api import ExtraButtonsMixin, button, confirm_action, link, view
from admin_extra_buttons.utils import HttpResponseRedirectToReferrer
from django.http import HttpResponse, JsonResponse
from django.contrib import admin
from django.views.decorators.clickjacking import xframe_options_sameorigin
from django.views.decorators.csrf import csrf_exempt
class MyModelModelAdmin(ExtraButtonsMixin, admin.ModelAdmin):
@button(permission='demo.add_demomodel1',
visible=lambda self: self.context["request"].user.is_superuser,
change_form=True,
html_attrs={'style': 'background-color:#88FF88;color:black'})
def refresh(self, request):
self.message_user(request, 'refresh called')
# Optional: returns HttpResponse
return HttpResponseRedirectToReferrer(request)
@button(html_attrs={'style': 'background-color:#DC6C6C;color:black'})
def confirm(self, request):
def _action(request):
pass
return confirm_action(self, request, _action, "Confirm action",
"Successfully executed", )
@link(href=None,
change_list=False,
html_attrs={'target': '_new', 'style': 'background-color:var(--button-bg)'})
def search_on_google(self, button):
original = button.context['original']
button.label = f"Search '{original.name}' on Google"
button.href = f"https://www.google.com/?q={original.name}"
@view()
def select2_autocomplete(self, request):
return JsonResponse({})
@view(http_basic_auth=True)
def api4(self, request):
return HttpResponse("Basic Authentication allowed")
@view(decorators=[csrf_exempt, xframe_options_sameorigin])
def preview(self, request):
if request.method == "POST":
return HttpResponse("POST")
return HttpResponse("GET")
FAQs
Django mixin to easily add buttons to any ModelAdmin
We found that django-admin-extra-buttons demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.