Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class user(models.Model):
- location = models.ManyToManyField(Locations, blank=True, null=True)
- class Locations(models.Model):
- location_id = models.AutoField(primary_key=True, verbose_name='location Id')
- location_name = models.CharField(max_length=512, unique=True, null=True, blank=True, verbose_name='location Name')
- location_list = user.location.through.objects.values('locations_id', 'locations,').filter(user_id=user_id)
- pprint.pprint(location_list)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement