Skip to main content

Django admin extra buttons with form

Project description

django-form-button

Django admin extra buttons with form

Screenshots

changelist

form

Installation

You can install the package via pip:

pip install django-form-button

Usage

from django.contrib import admin
from django.forms import FileField
from django.forms import Form
from django.http import HttpRequest
from django.http import HttpResponse

from django_form_button import FormButtonMixin
from django_form_button import form_button

from .models import Account


class UploadForm(Form):
    file = FileField()


@form_button("Upload Accounts", UploadForm)
def upload_accounts(request: HttpRequest, validated_form: Form):
    file = validated_form.cleaned_data["file"]
    return HttpResponse(file.name)


@admin.register(Account)
class AccountAdmin(FormButtonMixin, admin.ModelAdmin):  # type: ignore
    form_buttons = [upload_accounts]

License

This project is licensed under the terms of the MIT license.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Contact

If you want to contact me you can reach me at pradishbijukchhe@gmail.com.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-form-button-1.0.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

django_form_button-1.0.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file django-form-button-1.0.0.tar.gz.

File metadata

  • Download URL: django-form-button-1.0.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for django-form-button-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d656135f401a4c9929c0515ccf469d258785dac7e9060f2f16f3d4118fd34903
MD5 6225e9d8bc0ab9877739294228e0c48d
BLAKE2b-256 e5b393155640cd3fb2841f50238fa761e6e4f90a1b5fd7028ebf2112aee1f74f

See more details on using hashes here.

File details

Details for the file django_form_button-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_form_button-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fd99f5d913c273dd194b01ae375771f34d20ea5a7a1c01d57543d8f9d0bca348
MD5 b46f462a6391a0bfbf0fba78ae3884ee
BLAKE2b-256 9e151bf44fbf82a6e3fce517d87a786bcfac137ccc9c04f6f1fcf178ce2a0fb5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page