Hello, please have a look at my models.py.
models.py:
class Thread(models.Model):
pass
class ThreadParticipant(models.Model):
thread = models.ForeignKey(Thread)
user = models.ForeignKey(User)
class Message(models.Model):
thread = models.ForeignKey(Thread)
sent_date = models.DateTimeField(default=datetime.now)
body = models.TextField()
user = models.ForeignKey(User)
class MessageReadState(models.Model):
message = models.ForeignKey(Message)
user = models.ForeignKey(User)
read_date = models.DateTimeField()
I am having two problems when I try to create a new message:
I think I can solve this all in the views.py, but I think it will be better to solve this in the models.py. Please help me solve the problem. I would be very grateful. Thank you.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAHSNPWsLC1LW1pqpYe-FUmC4k4twxBV8HrLxRex4e6VNicoBdQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
IMHO with this design you first need an user and a thread to create a new message.In the admin interface you gonna look a + button to create a user and other to create a thread.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJJc_8VJCH01_SQZKOkAz%3DhwHgC%3Dsj-w%3DKLQTxJc1K92RZ11jw%40mail.gmail.com.