> On 11/7/06, Florian Apolloner <[EMAIL PROTECTED]> wrote:
> > 1.) In the admin-area you can use filters ( list_filter = ('is_staff',
> > 'is_superuser') ), which show by default all entries. Now I want to
> > have the entries prefilterd (let's say i have a boolean field, and want
> > all entries with true filtered out).
> > Which way is the easiest way to do so?
>
> list_filter should produce a list of links in the sidebar you can
> click on to filter according to the values of the field; for example;
> using 'is_staff' in list_filter for the auth.User model lets you click
> to see either all users who are staff, or all users who aren't.
>

Yes I see this box, but I (for example) don't won't to see all users
and have to klick on is_staff->yes, I want this to be preselected
(which means I don't want to see all by default) to show only
is_staff->yes, unless I klick no, or all.

> > 2.) Is there a hook or something to execute custom functions, if
> > someone clicks save in the admin area?
>
> For custom save functionality, your model class can supply a custom
> 'save' method which executes anything you like; the documentation has
> some simple examples:
> http://www.djangoproject.com/documentation/model_api/#overriding-default-model-methods

>> 2.) Is there a hook or something to execute custom functions, if
>> someone clicks save in the admin area?
>
>If you want to do it whenever a new model is created then you do this:
>
>class foo(model):
>    ...
>    def save(self):
>        #anything you want to do before
>        model.save(self)
>        #anything you want to do after


Thanks for the quick answers :)

Florian Apolloner


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to