Metadata-Version: 2.1
Name: django-form-button
Version: 1.0.0
Summary: Django admin extra buttons with form
Author-email: Pradish Bijukchhe <pradishbijukchhe@gmail.com>
License: Copyright (c) 2018 The Python Packaging Authority
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/sandbox-pokhara/django-form-button
Project-URL: Issues, https://github.com/sandbox-pokhara/django-form-button/issues
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: django

# django-form-button

Django admin extra buttons with form

## Screenshots

![changelist](docs/changelist.png)

![form](docs/form.png)

## Installation

You can install the package via pip:

```bash
pip install django-form-button
```

## Usage

```python
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.
