Task: keep track of the movement of something. For example, bunkers.
- Bins move between different objects.
It is important to be able to receive the following reports:
A) In one line the object "outgoing" and the object "destination". In the example in the picture, the movement of bunkers between seaports.

here ports and ships are objects
B) Report on the number of bunkers at the moment on each of the objects
B) report on the number of objects on each type of object (our port, ship, port of the customer)
One could use such a table design: +---------------+ | Field | +---------------+ | id | | object_out_id | | object_in_id | | qty | +---------------+ +---------------+ | Field | +---------------+ | id | | object_out_id | | object_in_id | | qty | +---------------+
.. then report A) is pulled out of the database by ORM means by a simple FLow.Objects.all() request, and for the rest of the reports, it would be necessary to use not the simplest SQL queries with which ORM cannot cope.
The second option is to record one movement of the bunker in two lines in the database. +----------------+ | Field | +----------------+ | id | | transaction_id | | object_id | | qty | +----------------+
Then ORM will cope with the majority of requests, everything works quickly, BUT - report A) as in the figure you cannot pull out with a simple request ...
I want to serialize it in JSON using the Django REST Framework.
RAW requests in DRF do not support pagination.
Advise which data storage model to choose, so that there would be no problems with outputting report A in JSON and for large amounts of data there would not be too long processing for other requests?