# How to list objects in a view like admin view?

**URL:** <https://forum.djangoproject.com/t/how-to-list-objects-in-a-view-like-admin-view/9758>\
**Category:** Using Django\
**Created:** [September 20, 2021, 3:02am UTC](https://forum.djangoproject.com/t/how-to-list-objects-in-a-view-like-admin-view/9758 "2021-09-20T03:02:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![diogoikaro](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/diogoikaro/32/5855_2.png) [@diogoikaro](https://forum.djangoproject.com/u/diogoikaro)\
**Post date:** [September 20, 2021, 3:02am UTC](https://forum.djangoproject.com/t/how-to-list-objects-in-a-view-like-admin-view/9758/1 "2021-09-20T03:02:38Z")

</div>

Hi, I’m new with django.  
I am trying to create a view that shows a list all objects of a model. Furthermore, I want that shows some attributes and enables ordering on click.

In short, I wish to build a view (page) like de admin page:

 ![Captura de tela de 2021-09-19 23-57-30](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/a/a9c94a0d766072b5cb2c8715c0fb5332d4f97cd0.png)

There’s a easy away to “copy” this page/view ?  
Thanks

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [September 20, 2021, 12:16pm UTC](https://forum.djangoproject.com/t/how-to-list-objects-in-a-view-like-admin-view/9758/2 "2021-09-20T12:16:07Z")

</div>

You mention that you are “Hi, I’m new with django.”

How new?

For example, have you worked through either or both of the [Official Django Tutorial](https://docs.djangoproject.com/en/3.2/intro/tutorial01/) or the [Django Girls tutorial](https://tutorial.djangogirls.org/en/)?

Have you already worked on one or more other projects?

Have you worked with the [generic Class Based Views](https://docs.djangoproject.com/en/3.2/ref/class-based-views/)? (If so, see the [ListView](https://docs.djangoproject.com/en/3.2/ref/class-based-views/flattened-index/#listview) as a starting point.)

You can also look at the source code for the admin page to see how it builds those lists.

The view is changelist\_view in django.contrib.admin.options. (Admittedly, that part of the code might be a bit “dense”, since it’s doing a lot of things that you aren’t looking to do. For example, if you’re just looking at producing the list, you can ignore all the parts of that view handling a POST.)

The template being used to render the list is change\_list\_results.html, located in django.contrib.admin.templates.admin.

You can look at the page that was rendered to see how the “sort” option is handled within the html. (Also notice what happens to the url when you select a column to sort.)

---

<div class="post-metadata">

**Author:** ![diogoikaro](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/diogoikaro/32/5855_2.png) [@diogoikaro](https://forum.djangoproject.com/u/diogoikaro)\
**Post date:** [September 20, 2021, 2:45pm UTC](https://forum.djangoproject.com/t/how-to-list-objects-in-a-view-like-admin-view/9758/3 "2021-09-20T14:45:42Z")

</div>

> Blockquote have you worked through either or both of the Official Django Tutorial or the Django Girls tutorial?

I have been worked through the Official Django Tutorial and the [Mozilla Django Web Framework](https://developer.mozilla.org/pt-BR/docs/Learn/Server-side/Django)  
But now I’m trying some think new.

Thanks for the reply. I am going to see the generic Class Based Views and the admin templates.
