This is my first Django experience and I'm having trouble figuring out
the right answer to the right relationship to have. (brain fart
maybe.. )
I have a site that users have profiles and can message each other. So
my model looks like:
class User(models.Model):
username = models.CharField(max_length=50)
password = models.CharField(max_length=50)
profile = models.ForeignKey(Profile)
class Profile(models.Model):
username = models.CharField(max_length=50, primary_key=True)
sex = models.CharField(max_length=50)
location = models.CharField(max_length=100)
....
class Messages(models.Model):
sender = models.CharField(max_length=100)
to = models.CharField(max_length=100)
subject = models.CharField(max_length=100)
message = models.TextField()
date = models.DateTimeField()
My question here is this a one-to-many relationship from Profile to
Messages? In that each profile has many messages or is it many-to-many
as each message has a sender and a recipient. Ultimately I want to be
able to easily pull the profile for the sender and recipient from the
message and from the User show their messages.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.