Advertisement
Guest User

Untitled

a guest
Jan 4th, 2013
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | None | 0 0
  1. #teams/models.py
  2. class Team(models.Model):
  3.     user = models.ForeignKey(User)
  4.  
  5. class Coordinator(models.Model):
  6.     user = models.ForeignKey(User)
  7.  
  8. class Wishlist(models.Model):
  9.     team = models.ForeignKey(Team)
  10.     coordinator = models.ForeignKey(Coordinator)
  11.  
  12. #i can't get to the wishlist through the Team object...
  13. #team.wishlist says 'Team' object has no attribute 'wishlist'
  14. #however:
  15. wishlists = Wishlist.objects.all()
  16. for w in wishlists:
  17.     print w.coordinator
  18.     print w.team
  19. #returns a list of the teams and coordinators.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement