You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(business): Streamline promo views and data handling
This commit refactors the `business` app's views and serializers to improve efficiency and clarify the logic for handling promo data.
Key changes:
- **Simplified Query Validation:** The `CompanyPromoListCreateView` now validates query parameters directly within the `get_queryset` method, removing the need for an intermediate `list` method override and instance variables.
- **Optimized Target Updates:** The `PromoDetailSerializer` now correctly handles updates to the `target` field by calling the parent `update` method first and then saving the `target` field specifically. This ensures atomicity and prevents unnecessary model saves.
- **Improved QuerySet Definition:** The `PromoManager` now defines `with_related_fields` as a tuple to clearly specify the fields for `only()`, making the query more readable and maintainable.
0 commit comments