You can get the model class for the modeladmin, it's the model property. So
modeladmin.model will give you the model class. You can just do a
check of equality
modeladmin.model == OurModel.

On Thu, Jul 30, 2009 at 1:22 PM, selcukcihan<selcukci...@gmail.com> wrote:
>
> Hi, i have django 1.1
>
> I have a user profile model, call it OurUser. I have defined a custom
> action, "send mail". This action is available in OurUser and django
> auth's User models. It is handled via a global function with this
> signature
>
> def send_mail_to_users(modeladmin, request, queryset):
>    selected = request.POST.getlist(admin.ACTION_CHECKBOX_NAME)
>    return HttpResponseRedirect(reverse('some view') + '?ids=%s' %
> ",".join(selected))
>
> This works well only for auth's User model(since it gets the correct
> ids). What i need is an if else of the form
> if modeladmin belongs to "User" then do something
> else if modeladmin belongs to "OurUser" then do something
>
> so that i can extract the User ids from OurUser and then redirect
> properly
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to