Closed seanlook closed 6 years ago
Are you looking for something like http://django-cruds-adminlte.readthedocs.io/en/latest/usage.html#overwrite-forms ?
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.
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.
I add my own form to XXCRUDView throuth add_form
, update_form
to get this.
Thank you for your work! :)
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.
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.
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 )
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.
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.
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()))
]
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 ?
Yep, I have to, I will this weekend.
Hey, @luisza we tried 0.0.7 from main branch of this repository. Still same problem.
Guys @MMParmar @luisza I've uploaded releases 0.0.7 and 0.0.8 to pypi:
Hope it helps... and sorry for the delay!.
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.
In documents
docs/components.rst
: to overwrite my own form, I need to giveform_class
andmodel
, but I don't find any words aboutCRUDCreateView
as used in this docs. I've triedMyCRUDView.get_create_view().as_view(model=XX, form_class=XXX)
, but template name NoneType error shows up.