oscarmlage / django-cruds-adminlte

django-cruds is simple drop-in django app that creates CRUD for faster prototyping
BSD 3-Clause "New" or "Revised" License
425 stars 82 forks source link

Where CRUDCreateView come from in docs #35

Closed seanlook closed 6 years ago

seanlook commented 7 years ago

In documents docs/components.rst: to overwrite my own form, I need to give form_class and model, but I don't find any words about CRUDCreateView as used in this docs. I've tried MyCRUDView.get_create_view().as_view(model=XX, form_class=XXX), but template name NoneType error shows up.

luisza commented 7 years ago

Are you looking for something like http://django-cruds-adminlte.readthedocs.io/en/latest/usage.html#overwrite-forms ?

luisza commented 7 years ago

Also see http://django-cruds-adminlte.readthedocs.io/en/latest/installation.html#cruds-for-app

Sorry components.rst is not updated, CRUDCreateView was delete in previous release.

seanlook commented 7 years ago

Yeah, crud_for_model with my custom form worked, but paginate_by and search_fields that defined in my own CRUDView that inherit from yours, does not work.

seanlook commented 7 years ago

I add my own form to XXCRUDView throuth add_form, update_form to get this.

Thank you for your work! :)

oscarmlage commented 7 years ago

Hey @luisza and @seanlook, how's the status of this? @seanlook do you have any proposal to make inherited search_fields and paginate_by work? or just adding add_form and update_form is good enough?.

OTOH I think we need to improve the documentation before to close the ticket, right?

Thanks both in advance.

luisza commented 7 years ago

Yes, I think documentation update is important, and I hope to do it in next few days. I am working in filter_fields here, it's working but I need to check a lot of things before send a PR.

About search_fields it's now supported, see documentation

About paginate_by it's also done, because you can overwrite the paginate_by element in CRUDView, so you can do something like.

from cruds_adminlte.crud import CRUDView
class Myclass(CRUDView):
    model = Book
    paginate_by = 20

Documentation of this it's also needed, I didn't make because template pagination not work in this moment, but I see, you corrected it in last commit.

luisza commented 7 years ago

Documentation updated in PR #40 ,

If you want to override a form with some other crispy features you can add to your testapp.urls the following::

from cruds_adminlte.urls import crud_for_model
urlpatterns += crud_for_model(Author, views=['create', 'update'], 
    add_form=AuthorForm,  update_form=AuthorForm )
MMParmar commented 6 years ago

Hey, I wanna use different pagination list in different template. I set paginate_by element in different class in view.py but its not working. If I changed paginate_by element in crudview class it gave same pagination in both list template. I also tried same demo given in this site https://github.com/oscarmlage/django-cruds-adminlte still its not working.

luisza commented 6 years ago

I don't understand your problem, but basically you need this

http://django-cruds-adminlte.readthedocs.io/en/latest/usage.html#pagination

and provide paginate_template attribute.

MMParmar commented 6 years ago

Hey, thanks for reply but I already tried that solution and its not working. I tried following code :

In View.py class AuthorCRUD(CRUDView): model = Author paginate_by = 20 paginate_template = 'cruds/pagination/enumeration.html'

class InvoiceCRUD(CRUDView): model = Invoice paginate_by = 5 paginate_template = 'cruds/pagination/enumeration.html'

In url.py

from testApp.views import AutorCRUD, InvoiceCRUD authorcrud = AutorCRUD() invoicecrud = InvoiceCRUD() urlpatterns = [ url(r'^$', include(authorcrud .get_urls())), url(r'^$', include(invoicecrud.get_urls())) ]

luisza commented 6 years ago

mmm Are you using pip packages ? if does, please use the main branch of this repository. This changes are not in pip because 0.0.7 is not uploated to pip. @oscarmlage could you upload 0.0.7 to pip ?

oscarmlage commented 6 years ago

Yep, I have to, I will this weekend.

MMParmar commented 6 years ago

Hey, @luisza we tried 0.0.7 from main branch of this repository. Still same problem.

oscarmlage commented 6 years ago

Guys @MMParmar @luisza I've uploaded releases 0.0.7 and 0.0.8 to pypi:

Hope it helps... and sorry for the delay!.

luisza commented 6 years ago

Hi, I think this issue could by closed. I don't now if @MMParmar solve his pagination problems, but I am sure that paginations works.