app-generator / django-dynamic-datatb

Django Dynamic Datatables - Open-Source Library | AppSeed
https://pypi.org/project/django-dynamic-datatb/
MIT License
43 stars 19 forks source link

Feature make modular #4

Closed Mortrest closed 1 year ago

Mortrest commented 1 year ago

Hello I apologize for the delay. We have some problems and they took a long time to solve.

Before merging, please test the requested branch. To use it:

  1. install datatb for another client project with pip install -e cloned-and-switched-to-branch-datatb-path
  2. to use data tb in client project, make an instance of DataTb Class and pass the model path to the constructor.
    ddt = DataTB(model_class_path="home.models.Product")
    def my_view(request):
    return render(request, 'sex.html', context={
        'data_table1': ddt.render(),
    })
  3. add expert and another endpoint URLs to urls.py files:
    path('datatb/<str:model_name>/<int:pk>/', csrf_exempt(DataTB.as_view())),    # <-- NEW: (Used by Dynamic DataTables)
    path('datatb/<str:model_name>/', csrf_exempt(DataTB.as_view())),    # <-- NEW: (Used by Dynamic DataTables)
    path('datatb/<str:model_name>/export/', csrf_exempt(export)),    # <-- NEW: (Used by Dynamic DataTables)
  4. use data_table1 in template:
    <div>
    {{ data_table1 }}
    </div>
app-generator commented 1 year ago

Hello guys,

Don't worry about the delay. I'm aware of the complexity of this task.

Please configure this sample project to validate the evolution:

https://github.com/app-generator/django-dynamic-datatb-tests/invitations

P.S. the PR is merged on the head (the library can be used via versions, so, we can update the HEAD)

Drop here a sign once the test project is configured and ready to be tested.

Ty guys for this. Adrian