Re: Use an arbitrary changelist

2009-07-28 Thread TiNo
On Wed, Jul 22, 2009 at 17:57, Alex Gaynor  wrote:

>
> On Wed, Jul 22, 2009 at 7:08 AM, TiNo wrote:
> > Hi,
> > I would like a second changelist for an app. Besides the changelist that
> > shows all members, I would like to show a changlist that show all members
> > interested in some category. I now I can apply a list filter in the main
> > list, but I rather have a separate list where the admin returns to after
> > editing someone from the list, and provide some actions in the
> object-tools
> > like sending an email to all members interested in that category.
> > How do I create a view with a changelist? I know I can override the
> > Changelist's get_query_set method, but with what parameters do I
> instantiate
> > it?
> > thanks,
> > TiNo
> > >
> >
>
> If you're on Django 1.1 beta or newer you can create a new model that
> is a proxy subclass of your existing one, then crete a seperate
> ModelAysedmin for it and overide the queryset() method on it to return
> your filtered queryset.
>
> alex
>

Ok. But how would I do this dynamically?
What I am trying to achieve is some sort of 'persistent filter'. I
would like members interested in some category to be accesible under
/admin/members/interested_in/something for each category. Would that
be possible this way?

Tino

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Use an arbitrary changelist

2009-07-22 Thread Some Guy

You want this...

http://blog.dougalmatthews.com/2008/10/filter-the-django-modeladmin-set/

Be aware though, of a bug* in manage.py that, if you dumpdata with
only your app specified, you will get entries for the proxy model as
well.
The proxy model entries will screw up your next loaddata, so I
recommend specifying each model to dump in your dumpdata command.


*the bug may have been fixed, but the report in trac does not show any
resolution

On Jul 22, 5:08 am, TiNo  wrote:
> Hi,
> I would like a second changelist for an app. Besides the changelist that
> shows all members, I would like to show a changlist that show all members
> interested in some category. I now I can apply a list filter in the main
> list, but I rather have a separate list where the admin returns to after
> editing someone from the list, and provide some actions in the object-tools
> like sending an email to all members interested in that category.
>
> How do I create a view with a changelist? I know I can override the
> Changelist's get_query_set method, but with what parameters do I instantiate
> it?
>
> thanks,
>
> TiNo
--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Use an arbitrary changelist

2009-07-22 Thread Alex Gaynor

On Wed, Jul 22, 2009 at 7:08 AM, TiNo wrote:
> Hi,
> I would like a second changelist for an app. Besides the changelist that
> shows all members, I would like to show a changlist that show all members
> interested in some category. I now I can apply a list filter in the main
> list, but I rather have a separate list where the admin returns to after
> editing someone from the list, and provide some actions in the object-tools
> like sending an email to all members interested in that category.
> How do I create a view with a changelist? I know I can override the
> Changelist's get_query_set method, but with what parameters do I instantiate
> it?
> thanks,
> TiNo
> >
>

If you're on Django 1.1 beta or newer you can create a new model that
is a proxy subclass of your existing one, then crete a seperate
ModelAysedmin for it and overide the queryset() method on it to return
your filtered queryset.

alex

-- 
"I disapprove of what you say, but I will defend to the death your
right to say it." -- Voltaire
"The people's good is the highest law." -- Cicero
"Code can always be simpler than you think, but never as simple as you
want" -- Me

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Use an arbitrary changelist

2009-07-22 Thread TiNo
Hi,
I would like a second changelist for an app. Besides the changelist that
shows all members, I would like to show a changlist that show all members
interested in some category. I now I can apply a list filter in the main
list, but I rather have a separate list where the admin returns to after
editing someone from the list, and provide some actions in the object-tools
like sending an email to all members interested in that category.

How do I create a view with a changelist? I know I can override the
Changelist's get_query_set method, but with what parameters do I instantiate
it?

thanks,

TiNo

--~--~-~--~~~---~--~~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---