Actually I need to use *Thread* class in other class as a ForeignKey. Here is the whole code:
class Thread(models.Model): thread_pk = models.PositiveIntegerField(default=self.pk) 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) Is there anyway to create a new message without manually creating a *Thread*. I mean to auto-populate the Thread, whenever I create a new *Message*? -- 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+unsubscr...@googlegroups.com. To post to this group, send email to django-users@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/CAHSNPWt14jxduA_kT-Yxj-7k02qZzZkvkbfYU2pEPFghbNq%3DEg%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.