Advertisement
Guest User

Untitled

a guest
Aug 4th, 2015
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. class user(models.Model):
  2. location = models.ManyToManyField(Locations, blank=True, null=True)
  3.  
  4. class Locations(models.Model):
  5. location_id = models.AutoField(primary_key=True, verbose_name='location Id')
  6. location_name = models.CharField(max_length=512, unique=True, null=True, blank=True, verbose_name='location Name')
  7.  
  8. location_list = user.location.through.objects.values('locations_id', 'locations,').filter(user_id=user_id)
  9. pprint.pprint(location_list)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement