If you want to add a profile for each user, check out
http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/

the key in django is reusing existing "applications"
maybe this might help
http://code.google.com/p/django-messages/

On Thu, Jan 21, 2010 at 6:16 AM, Chris <caleb.s...@gmail.com> wrote:

> 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 django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
>
>
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Reply via email to