Thursday, May 28, 2020

filter on multiple tables

Actually I want to filter all users those are matched with currently logged in users based on location or education details like maybe institute_name or specialization. Is it possible to search in multiple tables?!
I almost spent 2 days but still I stuck in the position.
Any help would be appreciated.

Thank You

Regards,
Soumen


class Location(models.Model):
    name = models.CharField(max_length = 15)

class Profile(models.Model):
    user = models.OneToOneField(
        settings.AUTH_USER_MODEL,
        on_delete = models.CASCADE,
        related_name="profile"
    )
    location = models.ManyToManyField(Location,related_name = 'user_locations')

class Education(models.Model):
    profile = models.ForeignKey(Profile, on_delete=models.CASCADE,related_name="profiles")
    institute_name = models.CharField(max_length = 250)
    specialization = models.CharField(max_length = 100)


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

No comments:

Post a Comment