Hi,

I'm facing challenges to get the result of below problem,I have two models
in my application i.e.,


class UserMenu(models.Model):
    name = models.CharField(max_length=50)

    def __str__(self):
        return self.name


class MenuMapping(models.Model):

    user_menu = models.ManyToManyField(UserMenu, verbose_name='Menu')
    user_group = models.ForeignKey(Group, related_name='user_group',
verbose_name='Department', on_delete=models.SET_NULL, null=True) # refers -
auth.group which is linked with users


    def __str__(self):
        return self.user_group.name



Now I want to get the list of UserMenu mapped with the user_group of logged
in user.

I could not able to get expected result with prefetch_related or
select_related,

Can anybody help ??

-- 
Thanks & Regards,

Raja Sekar Sampath
+91 9087434567.

-- 
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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAAS5AE5yjCtcdGOgx0sGhUBpWXkrCfCirTanqYaDddXzmRbp9Q%40mail.gmail.com.

Reply via email to