Answer the question
In order to leave comments, you need to log in
How to link 2 fields?
I can’t figure it out, I have a Chat and Message model, what connection should I use in this case and how can I add an object of the Message class there, I thought to just make a list, without a connection and add it there, but it is not entered into the database.
Answer the question
In order to leave comments, you need to log in
What exactly are the difficulties?
Something like this - and forward:
class Chat(models.Model):
...
class Message(models.Model):
chat = models.ForeignKey(Chat, on_delete=models.CASCADE)
...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question