ModelAdmin

29 views
Skip to first unread message

Mario St-Gelais

unread,
Jan 4, 2023, 2:26:41 PM1/4/23
to django...@googlegroups.com
Hello group, first post here.
Quick question.  Can capabilities of ModelAdmin such as list_filter or search_fields be used outside of the admin interface?

I want a view that would allow non logged users to search a site through checkboxes and some search fields possibly and obviously, the way this is implemented in the admin view is rather good.  

Alternatively, what approach can be used in django?

Thanks
Mario

Mike Dewhirst

unread,
Jan 4, 2023, 10:40:14 PM1/4/23
to django...@googlegroups.com
On 5/01/2023 5:43 am, Mario St-Gelais wrote:
Hello group, first post here.
Quick question.  Can capabilities of ModelAdmin such as list_filter or search_fields be used outside of the admin interface?

Have you looked at htmx?

https://www.simplecto.com/htmx-and-the-list_editable-in-django-admin/

htmx is very sweet. Essentially, you can replace a named <div id="whatever"></div> on an existing page by calling whatever view you care to write. Your view might have to borrow from the Django code if you really like what it does.

Digressing slightly, I discovered that you can make a link in html using the <a> entity and just replace href="/search" with hx_trigger="/hx_search", for example, so that the existing css works and it looks like an ordinary link.

Cheers

mike


I want a view that would allow non logged users to search a site through checkboxes and some search fields possibly and obviously, the way this is implemented in the admin view is rather good.  

Alternatively, what approach can be used in django?

Thanks
Mario
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFmF6_vLzivA3Y-sskqmcZzsuLc27opP6xW3m3wvmV7nepu%3D-A%40mail.gmail.com.


-- 
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Just
ask and I'll send it to you. Your email software can handle signing.
OpenPGP_signature

Satyajit Barik

unread,
Jan 4, 2023, 11:31:56 PM1/4/23
to django...@googlegroups.com
Yes. It does. ModelAdmin classes can define list filters that appear in the right sidebar of the change list page of the admin.
For more reference: https://docs.djangoproject.com/en/4.1/ref/contrib/admin/filters/

For this topic related join our WhatsApp group: https://bit.ly/3oJtfcf

Regards,
Satyajit

Mike Dewhirst

unread,
Jan 4, 2023, 11:56:38 PM1/4/23
to django...@googlegroups.com
Satyajit

I'm speaking for myself here.

I'm not comfortable with dilution of list content with what appears to be a competing Whatsapp group.

In particular, this thread is one to which I have contributed and if you kidnap the thread you cut me out of my conversation.

In general, if you take conversations away from the list you hide them from core Django devs who are then deprived of information coming from users. Django users are exactly equal to customers of an enterprise and if an enterprise doesn't hear customer feedback it risks becoming irrelevant and possibly going out of business.

I think Whatsapp, Slack etc are all very appropriate places for private conversations. Not so much for a user mutual-support mailing list like this one.

 Thanks for understanding

Cheers

Mike
OpenPGP_signature
Reply all
Reply to author
Forward
0 new messages