How to select and delete multiple objects on Wagtail admin UI? - django

What I wanted should be the so-called bulk-operations, i.e. on Django admin, for a Django model there could be many objects created, and we can select multiple of them and delete.
However, when I registered Django models in Wagtail, the Wagtail admin doesn't show anything similar to Django bulk operations.
And I searched for a while, looks like bulk operations are not supported in Wagtail admin?
Any other alternative we could use for Wagtail?

As of Wagtail 2.9, I don't think it's possible to bulk select pages, but you can do so with snippets.
You can submit a feature request regarding bulk selections in page lists on GitHub, but search first if such a request already exists before creating a new one.

Related

Wagtail - Revisions for Non-Page Objects

I use vanilla django models (they do not inherit from Page) and the modeladmin module of wagtail to replace the standard django admin with the wagtail admin interface. This is all working great, but I now wish to add revision history and rollback to these models.
Wagtail of course has it's own system for managing revisions of objects that inherit from Page, but they would not apply to standard django models. On the other hand, I have been looking at using the django-revisions app to have this functionality. Although this works, django-revisions only provides a standard django admin view, which is not compatible with wagtail, and I would prefer to not have users switching between the two completely different looking admin areas.
Does anybody have experience with managing revisions and rollbacks of standard model instances within the context of wagtail?
I have not tried this yet, but you can now have revisions on and customize the admin interface for snippets. I am going to try registering my model as a snippet to take advantage of both those features while maintaining the features of ModelAdmin.
This is new in Wagtail 4.0.

Filter data in django admin page

I have a django project, in one of admin pages I'm adding data to the table
And I want after I choose one of themes, in Students name will be only students enrolled for this theme. How I can filter them by theme name?
Django does not do this out of the box. One third-party package I often see recommended to accomplish this common task (as opposed to writing your own ajax to do it) is django smart selects.

form from multiple models

I need to create a form where the rows are a list of users and the columns are all the user's permissions. The models are the default django User's and django Permission's models.
How can I do this things? Are there a way to do by django forms or I must do manually with django and js?
If you just want to view this data, extract the relevant information (User and Permission instances), and then generate a table using django templates. Django intentionally does not 'bless' any css or js frameworks, so you are required to do the html yourself (using tools of your choosing).
Forms aren't going to help you here I don't think. I advise you to draw up what it is you want to see, and start figuring out what the html is going to need to look like. Forms in django are simply a mechanism for passing data between django and the user. You are free to render them how you wish.

Django admin: two change lists on the same page

I am trying to make an overview page for one of my models I have read through all of http://www.djangobook.com/en/1.0/.chapter17/ and understand how I can add my own custom views for a model to the django admin.
What I am currently trying to do is add multiple filtered change lists (presenting some child models) onto my "overview" page for the model. In these I would like to be able to make use of some of the admin features such as editable fields or actions.
Does anyone have some pointers on how I can best get started with this.
Check this out
He created a proxy model for the original model to avoid the conflict. You can create a new model admin or inherit the old ModelAdmin(as shown in the link)

Django admin, section without "model"?

in the Django administration console, all section (menu links) come from models with database tables, but what would I need to do if I need a section without a corresponding model object (no database table) that fetches data from other section with model?
Any ideas? Thanks
It looks like you want to add new admin urls with your own customized views and template: django.contrib.admin.ModelAdmin.get_urls
You can construct those new admins without a new model this way.
I did it with Proxy Models....