Hi!

Override ModelAdmin get_form() method and filter your field.

class MyAdmin(admin.ModelAdmin):
    def get_form(self, request, obj=None, **kwargs):
        form = super(MyAdmin,self).get_form(request, obj,**kwargs)
        form.base_fields['field'].queryset =
form.base_fields['field'].queryset.filter(user=request.user)
        return form

2012/4/11 Setiaman Lee <setiaman....@gmail.com>

> Hi,
>
> I managed to set in the QuerySet of ModelAdmin  to only allow user to
> see their own record.
> But when the child model link to parent model using ForeignKey a Drop
> Down will be automatically created for the respective column.
> Is there anyway to filter the drop down to only show the records that
> has been created by the login user?
>
>
> Rgrds,
> Setiaman Lee.
>
> --
> 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.
>
>

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