Hi list
I'm having some trouble overriding the queryset for my inline admin.
Here's a bog-standard parent admin and inline admin:
class MyInlineAdmin(admin.TabularInline):
model = MyInlineModel
def queryset(self, request):
qs = super(MyInlineAdmin, self).queryset(request)
return qs
class ParentAdmin(admin.ModelAdmin):
inlines = [MyInlineAdmin]
admin.site.register(ParentAdminModel, ParentAdmin)
Now I can do qs.filter(user=request.user) or
qs.filter(date__gte=datetime.today()), no problem.
But what I need is either the MyInlineModel instance or the ParentAdminModel
instance (not the model!), as I need to filter my queryset based on that.
Is it possible to get something like self.instance or obj (like in
get_readonly_fields())?
Hope this makes sense. Any help is much appreciated.
Patrick
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.