How to design a Django database schema for tracking user-item interactions (with quantities) to enable analytics and reporting?"
I'm building a Django web app to manage item stock, where authenticated users can "take" items from inventory (I'm not using djangos authentication system, is more like the user enters a code and the app checks in SQL Server if exists then saves the session info). I need to store user interactions to later analyze and visualize data such as:
- Recent items taken
- Most popular items
- User-specific activity
- Date-filtered interactions
- Total quantities taken per item
- Full interaction history, etc.
Im thinking each interaction should record:
- User who performed the action
- Items taken (multiple items per interaction)
- Quantity taken per item
- Timestamp
The current structure I have is Users and Items Users (Django's built-in User model) Items (Model with fields like name, stock_quantity, etc.)