views:

189

answers:

1

I’m just beginning to learn Django and I like the automatic listing in Django admin and the way you can configure filters and what columns to show. Is it possible to use it in my own applications?

I’ve looked in the source for the admin and figured out that I probably want to subclass the “ChangeList”-object in some way and use it in my own views. Any ideas?

+1  A: 

You're better off doing the following.

  1. Define a regular old Django query for your various kinds of filters. These are very easy to write.

  2. Use the supplied generic view functions. These are very easy to use.

  3. Create your own templates with links to your filters. You'll be building a list links based on the results of a query. For a few hard-coded cases, this is very easy. In the super-general admin-interface case, this is not simple.

Do this first. Get it to work. It won't take long. It's very important to understand Django at this level before diving into the way the admin applications work.

Later -- after you have something running -- you can spend several hours learning how the inner mysteries of the admin interface work.

S.Lott
Thank you! You where absolutely right, after a few hours I got it working the way I wanted following your suggestion instead.
Martin