V
V
Vyacheslav Rakhinsky2016-03-15 13:23:06
Django
Vyacheslav Rakhinsky, 2016-03-15 13:23:06

How to design api when models are related as 1-m chain?

For example, there are three models or resources,
For example: Ticket -1-m- Message -1-m- Attachment
In principle, they can be represented as separate resources and picked up separately when constructing the output.
But when creating a new ticket, you need to intercept the moment when a possible message with files was added to the database, and not just the ticket itself.
In cases with django, it turns out that post_save for the first model comes earlier than pre_save for the inline model, which is actually logical. And I can't figure out how to get around this.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question