Display a view of a single record?

1 view
Skip to first unread message

derek

unread,
Nov 6, 2009, 1:55:18 AM11/6/09
to Django users
One of the needs I have (and, I imagine, others too) is to be able to
display a view of a single record in a table. This is the case when
the record has many fields, not all of which are appropriate for (or
need to be) display in the normal list view.

What I need to know is: is this a "standard" feature in the admin
interface? If so, how do I go about activating it? If not, could
someone please explain how to extend the admin interface for this to
work?

Thanks!

Tomasz Zieliński

unread,
Nov 6, 2009, 6:24:14 PM11/6/09
to Django users
Do you mean displaying single record on change list?
You can try using search or filtering features for this.

--
Tomasz Zieliński
http://pyconsultant.eu

derek

unread,
Nov 8, 2009, 1:44:38 AM11/8/09
to Django users
I am not sure what you mean by "on change list"?

The usual way that records get displayed is in a tabular list format.
This is suitable when a record only has a few fields; some tables
however
have many fields in them and so would need to be displayed "in full"
just
by themselves.

I am looking for a way to have a link to this "detail view" embedded
in each
line entry of the normal tabular list display - a type of "click here
for more
details" link. This would not form part of a search or query.

On Nov 7, 1:24 am, Tomasz Zieliński <tomasz.zielin...@pyconsultant.eu>
wrote:

joker

unread,
Nov 8, 2009, 8:27:16 AM11/8/09
to Django users
do u want to see last or first record?

derek

unread,
Nov 9, 2009, 2:48:33 AM11/9/09
to Django users
Well, the link to view a record would appear on each and every
record line in the nomal tabular list.
> > > Tomasz Zielińskihttp://pyconsultant.eu- Hide quoted text -
>
> - Show quoted text -

Ludwik Trammer

unread,
Nov 9, 2009, 7:37:46 AM11/9/09
to Django users
I have a really hard time understanding what do you need, and I
suspect I'm not the only one. You are talking about the admin
interface, right? It displays a list containing all records, and when
you click on a record you go to a page that shows all fields for this
record (and lets you change their values). Isn't that exactly what you
want?

If the problem is that you don't want the fields to be editable,
because you just want to display read-only lists of records: re-think
using admin interface. It is meant specifically for managing records
on your website. Just use
"django.views.generic.list_detail.object_list" (display list of
records) and "django.views.generic.list_detail.object_detail" (display
detailed view of a single record) generic views:

http://docs.djangoproject.com/en/dev/ref/generic-views/#django-views-generic-list-detail-object-list
http://docs.djangoproject.com/en/dev/ref/generic-views/#django-views-generic-list-detail-object-detail

derek

unread,
Nov 10, 2009, 4:36:53 AM11/10/09
to Django users
Yes, the fields should not be editable in a "view".

However, I do not see it as "a problem" - more as "a desirable
feature". There are any number of use cases for letting users see
detailed record data but not be able (or not need, at that point in
time) to edit it. This feature is not meant to replace the existing
ability to edit a record; but to add another option to the interface.

It just seems strange to me that the admin interface allows for
display of multiple records in a listing, but has no facility to
display a complete, single record "view". I do not want to have
redevelop an admin-like interface just to allow for this option (given
that is such a generic one).

It is not clear from what you say - but I assume that it is not
possible to readily alter the current admin interface to incorporate
the generic views you refer to? If it is, any guidance, or examples,
along these lines would be appreciated.


On Nov 9, 2:37 pm, Ludwik Trammer <lud...@gmail.com> wrote:
> I have a really hard time understanding what do you need, and I
> suspect I'm not the only one. You are talking about the admin
> interface, right? It displays a list containing all records, and when
> you click on a record you go to a page that shows all fields for this
> record (and lets you change their values). Isn't that exactly what you
> want?
>
> If the problem is that you don't want the fields to be editable,
> because you just want to display read-only lists of records: re-think
> using admin interface. It is meant specifically for managing records
> on your website. Just use
> "django.views.generic.list_detail.object_list" (display list of
> records) and "django.views.generic.list_detail.object_detail" (display
> detailed view of a single record) generic views:
>
> http://docs.djangoproject.com/en/dev/ref/generic-views/#django-views-...http://docs.djangoproject.com/en/dev/ref/generic-views/#django-views-...

Alex Robbins

unread,
Nov 10, 2009, 9:55:47 AM11/10/09
to Django users
Derek,

If you want something that display data but doesn't allow you to edit
it, you should check out the databrowse[1] contrib app. You just
register a model with it (like the admin) and it generates all the
pages. It lets users look through the data, but not edit it.

[1]http://docs.djangoproject.com/en/dev/ref/contrib/databrowse/

Hope that helps,
Alex
> >http://docs.djangoproject.com/en/dev/ref/generic-views/#django-views-......

derek

unread,
Nov 11, 2009, 4:52:32 AM11/11/09
to Django users
Cool! Thanks Alex - that is exactly what I want.

On Nov 10, 4:55 pm, Alex Robbins <alexander.j.robb...@gmail.com>
wrote:
Reply all
Reply to author
Forward
0 new messages