SHOW:
|
|
- or go back to the newest paste.
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 | #sybcdb creates a new table called teams_wishlist with the fields: | |
12 | - | #i can't get to the wishlist through the Team object... |
12 | + | # id, team_id, coordinator_id, etc (extra wishlist related fields). |
13 | ||
14 | #in the shell I can't get to the wishlist through the Team object... | |
15 | #team.wishlist says 'Team' object has no attribute 'wishlist' | |
16 | #however: | |
17 | wishlists = Wishlist.objects.all() | |
18 | for w in wishlists: | |
19 | print w.coordinator | |
20 | print w.team | |
21 | #returns a list of the teams and coordinators. |