Add allocation variety change history UI
This commit is contained in:
@@ -25,11 +25,15 @@ class VarietyViewSet(viewsets.ModelViewSet):
|
||||
|
||||
|
||||
class PlanViewSet(viewsets.ModelViewSet):
|
||||
queryset = Plan.objects.all()
|
||||
queryset = Plan.objects.select_related('crop', 'variety', 'field').prefetch_related(
|
||||
'variety_changes',
|
||||
'variety_changes__old_variety',
|
||||
'variety_changes__new_variety',
|
||||
)
|
||||
serializer_class = PlanSerializer
|
||||
|
||||
def get_queryset(self):
|
||||
queryset = Plan.objects.all()
|
||||
queryset = self.queryset
|
||||
year = self.request.query_params.get('year')
|
||||
if year:
|
||||
queryset = queryset.filter(year=year)
|
||||
|
||||
Reference in New Issue
Block a user