Giter VIP home page Giter VIP logo

app-generator / django-dynamic-datatb Goto Github PK

View Code? Open in Web Editor NEW
43.0 5.0 19.0 114 KB

Django Dynamic Datatables - Open-Source Library | AppSeed

Home Page: https://pypi.org/project/django-dynamic-datatb/

License: MIT License

Python 34.03% HTML 17.79% JavaScript 47.13% CSS 1.05%
datatables django dynamic-programming open-source pypi-package datatable django-datatables django-tables datatable-django django-and-datatables

django-dynamic-datatb's Introduction

Open-Source library for Django that provides a powerful data table interface (paginated information) with minimum effort - actively supported by AppSeed.


Features

  • Modern Stack: Django & VanillaJS
  • DT layer provided by Simple-DataTables
  • Server-side pagination
  • Search, Filters
  • Exports in PDF, CSV formats
  • MIT License (commercial use allowed)

Django Dynamic DataTables - Open-Source tool provided by AppSeed.


How to use it


Step #1 - Install the package

$ pip install django-dynamic-datatb
// OR
$ pip install git+https://github.com/app-generator/django-dynamic-datatb.git

Step #2 - Update Configuration, add new imports

import os, inspect
import django_dyn_dt

Step #3 - Update Configuration, include the new APPs

INSTALLED_APPS = [
    'django_dyn_dt',  # <-- NEW App
]

Step #4 - Update Configuration, include the new TEMPLATES DIR

TEMPLATE_DIR_DATATB = os.path.join(BASE_DIR, "django_dyn_dt/templates") # <-- NEW App

TEMPLATES = [
    {
        "BACKEND": "django.template.backends.django.DjangoTemplates",
        "DIRS": [TEMPLATE_DIR_DATATB],                                  # <-- NEW Include
        "APP_DIRS": True,
        "OPTIONS": {
        },
    },
]

Step #5 - Update Configuration, update STATICFILES_DIRS DIR

DYN_DB_PKG_ROOT = os.path.dirname( inspect.getfile( django_dyn_dt ) ) # <-- NEW App

STATICFILES_DIRS = (
    os.path.join(DYN_DB_PKG_ROOT, "templates/static"),
)

Step #6 - Register the model in settings.py (DYNAMIC_DATATB section)

This sample code assumes that app1 exists and model Book is defined and migrated.

DYNAMIC_DATATB = {
    # SLUG -> Import_PATH 
    'books'  : "app1.models.Book",
}

Step #7 - Update routing, include APIs

from django.contrib import admin
from django.urls import path, include         # <-- NEW: 'include` directive added

urlpatterns = [
    path("admin/", admin.site.urls),
    path('', include('django_dyn_dt.urls')),  # <-- NEW: API routing rules
]    

Step #8 - Use the Dynamic Datatable module

If the managed model is Books, the dynamic interface is /datatb/books/ and all features available.


Django Dynamic DataTables - Open-Source Tool for Developers.


Links & resources



Django Dynamic DataTables - Open-source library provided by AppSeed

django-dynamic-datatb's People

Contributors

app-generator avatar mchoopani avatar mominur-helios avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

django-dynamic-datatb's Issues

improvments for widgets

Choices option is not working, you can check below:

TRAINING_TYPE_CHOICES = (
    (TRAINING, 'TRAINING'),
    (MATCH, 'MATCH'),
    (REGENERATION, 'REGENERATION'),
    (REHABILITATION, 'REHABILITATION'),
    (OTHER, 'OTHER'),
)

training_type = models.PositiveSmallIntegerField(choices=TRAINING_TYPE_CHOICES, default=1, null=False, blank=False)

DataField and TimeField Widget Problem. Widgets are wrong (date widget in time input)

training_date = models.DateField(null=True, blank=True, default='2020-05-21')
start_time = models.TimeField(null=True, blank=True, default='00:00:')
end_time = models.TimeField(null=True, blank=True, default='00:00:')

bug_datatb

"Related Field has invalid lookup: icontains"

Hello

Thank for the app, i couldn't make it work with my model, it seems like the app doesn't work with ForeignKey field or M2M fields

The issue appears in the view.py

for field in headings: filter_options = filter_options | Q(**{field + '__icontains': search_key})

i've tried to override the logic but couldn't make it run with my FK models

Thank you!

Adding columns of type picture to table

Using the model to build the database, I specified one of the fields:
photo=models.ImageField(upload_to="images/", blank=True, null=True)
but when adding a record, it is impossible to add a file or an image
is there any solution to this problem or should I deal with the code myself and rewrite some points?

image
image

Custom DataTable

I think it is better to have a custom data table and not use bootstrap or simple-datatables
So, I implemented an initial table if you like it, inform me to complete it.

Improvements

Suggested in yTube

I would like to share feedback for further improvement:

  • Allow for "default" fields that need to be shown in the list view. In my situation, not all fields are required to be shown in the list view, only when the detailed view is clicked they should be shown;
  • Make default filters set - Similarly to the above one, default filters will be very useful, accomplishing the same thing as not showing not needed data;
  • Unnecessary JS - There are a couple of places where JS is used to load data as well as certain fields. This makes it a bit more complex to read/understand than feeding the data in the actual Python template. e.g. The heading for the model name on the top of the page is configured with JS, but it's provided in the context of the view anyways, so a simple {{model_name}} will accomplish the same thing.

Usability - Solution to use the library as a widget

Hello @Mortrest

The current version of the library works as a separate page with its own links and actions.

We need to find a solution to provide the same features as a widget where the user can embed this dataTable element in any page.

The NEW requirements:

  • Handle any model enabled by Config (as it is now)
  • Datatables View can be embedded in any page
  • All Exports available

Here are some other packages that look more or less similar:

Let's brain storm around these new requirements and let's go.

ty!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.