Skip to main content

Advanced tables for django cruds

Project description

Django Scotty

Advanced table views for Django with filters, exports, and bulk actions.

Features

  • 🚀 Enhanced Table Views: Built on top of django-tables2 with additional functionality
  • 🎯 Filtering: Integrated django-filters support with beautiful UI
  • 📊 Export to Excel: Export table data to XLS/XLSX formats using tablib
  • Bulk Actions: Perform actions on multiple records at once
  • 🎨 Modern UI: Beautiful templates using django-cotton and Bootstrap
  • 🔧 Customizable: Easy to extend and customize for your needs

Installation

Install using pip:

pip install django-scotty

Or using uv:

uv pip install django-scotty

Quick Start

  1. Add django_scotty to your INSTALLED_APPS:
INSTALLED_APPS = [
    ...
    'django_cotton',
    'django_tables2',
    'django_filters',
    'django_scotty',
    ...
]
  1. Create a table view in your views.py:
from django_scotty.list_views.helpers import CottonTableView
import django_tables2 as tables
from .models import YourModel

class YourModelTable(tables.Table):
    class Meta:
        model = YourModel
        fields = ['field1', 'field2', 'field3']

class YourModelListView(CottonTableView):
    model = YourModel
    table_class = YourModelTable
    title = 'Your Model List'
    paginate_by = 25
  1. Add to your urls.py:
from django.urls import path
from .views import YourModelListView

urlpatterns = [
    path('your-model/', YourModelListView.as_view(), name='yourmodel-list'),
]

Advanced Features

Filtering

Add a FilterSet to enable filtering:

import django_filters

class YourModelFilter(django_filters.FilterSet):
    class Meta:
        model = YourModel
        fields = ['field1', 'field2']

class YourModelListView(CottonTableView):
    model = YourModel
    table_class = YourModelTable
    filterset_class = YourModelFilter

Export to Excel

Export functionality is enabled by default. Users can click the "Export to XLS" button.

Bulk Actions

Define custom actions in your view:

from django_scotty.list_views.helpers import CottonTableView, action

class YourModelListView(CottonTableView):
    model = YourModel
    table_class = YourModelTable
    
    @action(short_description="Mark as processed")
    def mark_processed(self, request, queryset):
        queryset.update(processed=True)
        return self.success_message("Records marked as processed")

Requirements

  • Python >= 3.8
  • Django >= 3.2
  • django-cotton >= 0.9.0
  • django-tables2 >= 2.4.0
  • tablib[xls,xlsx] >= 3.0.0
  • django-filter >= 22.1

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Credits

Built with:

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_scotty-0.1.5.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_scotty-0.1.5-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

Details for the file django_scotty-0.1.5.tar.gz.

File metadata

  • Download URL: django_scotty-0.1.5.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.5

File hashes

Hashes for django_scotty-0.1.5.tar.gz
Algorithm Hash digest
SHA256 e76a898d598d2eddee3bbe555a7a91fbf87ff512c244efb4b674c4d4bfd7e99c
MD5 2cacc1142a7be6bdbdd2be4f90ef39d6
BLAKE2b-256 113877613eab16a761bde779a62a85b7833e6c20b8566aaed8c87cc95c120f74

See more details on using hashes here.

File details

Details for the file django_scotty-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for django_scotty-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 0f9db521f3da316b0c83ef85bb415c6a2dd8fcbeab147f6d6a8ded9959b9abee
MD5 118f74918b1306867f19debd50b0f836
BLAKE2b-256 8b8d5e777872b0dec73c1ad5fbd9c95358d0e59ff002de46c52cfb030b61aacc

See more details on using hashes here.

Supported by

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