filter admin show in django by users
|July 22, 2014||Posted by forumadmin under TechQns||
I add one ManyToManyField to my Users profile:
class MyUser(models.Model): user = models.OneToOneField(User) news_letters = models.ManyToManyField(news_letter)
and replace it with my user admin:
class UserInline(admin.StackedInline): model = MyUser can_delete = False verbose_name_plural = 'MyUser' # Define a new User admin class UserAdmin(UserAdmin): inlines = (UserInline, ) admin.site.unregister(User) admin.site.register(User, UserAdmin)
I have news_letter model in my django admin, every user can see all news_letter records in django admin, I want to show just such records that in MyUser.news_letters for specific user.
How can I do this?
|Asked By – user3726821||Read Answers|