Re: Django-Tastypie and MySQL

2013-06-14 Thread Sithembewena Lloyd Dube
Much better. I don't think that you have to put quotes when you define player_club. Just go, player_club = models.ForeignKey(Club) - you want to pass the Club model, not a string. Regarding the question, if the player can only belong to one club, then a foreignkey relationship is correct because i

Re: Django-Tastypie and MySQL

2013-06-14 Thread Hélio Miranda
Ok, so what I did was this: Código (Python): class Player(models.Model): player_name = models.CharField(max_length=200) player_age = models.CharField(max_length=200) player_club = models.ForeignKey('Club') class Club(models.Model): club_name = models.CharField(max_length=200) I

Re: Django-Tastypie and MySQL

2013-06-14 Thread Sithembewena Lloyd Dube
I meant, delete the PlayerClub linking table/ model. The foreignkey relationship takes care of that need. On Fri, Jun 14, 2013 at 4:41 PM, Sithembewena Lloyd Dube wrote: > Hey, > > The player belongs to a club. So in the player model you should have > > player_club = models.ForeignKey(Club) > >

Re: Django-Tastypie and MySQL

2013-06-14 Thread Sithembewena Lloyd Dube
Hey, The player belongs to a club. So in the player model you should have player_club = models.ForeignKey(Club) then remove the foreign key in the Club model. Also, notice casing - your variable names should be lowercase and if it's more than one word, join it with underscores. It's Python conve

Re: Django-Tastypie and MySQL

2013-06-14 Thread Hélio Miranda
After reading a bit what I did was the following: Código (Python): from django.db import models class Player(models.Model): #idPlayer = models.AutoField(primary_key=True) PlayerName = models.CharField(max_length=200) PlayerAge = models.CharField(max_length=200) #Clubs = models.ManyT

Re: Django-Tastypie and MySQL

2013-06-14 Thread Sithembewena Lloyd Dube
Hi Hélio, I happen to be using Tastypie for the first time as well and so far, the documentation is comprehensive enough. You could start here: http://django-tastypie.readthedocs.org/en/latest/tutorial.html http://django-tastypie.readthedocs.org/en/latest/cookbook.html http://django-tastypie.read