from django.contrib import admin
from .models import Measurement

admin.site.register(Measurement)

from django.contrib import admin
from .models import Measurement


class MeasurementAdmin(admin.ModelAdmin):
    model = Measurement

    def get_queryset(self, request):
        return super(MeasurementAdmin, self).get_queryset(request).select_related('patient__user')

admin.site.register(Measurement, MeasurementAdmin)

Improve performance @ Measurement Admin
Improve performance @ Measurement Admin

  from django.contrib import admin
  from .models import Measurement
  
- admin.site.register(Measurement)
  
+ class MeasurementAdmin(admin.ModelAdmin):
+     model = Measurement
+ 
+     def get_queryset(self, request):
+         return super(MeasurementAdmin, self).get_queryset(request).select_related('patient__user')
+ 
+ admin.site.register(Measurement, MeasurementAdmin)
+ 
Improve performance @ Measurement Admin
## Code Before:
from django.contrib import admin
from .models import Measurement

admin.site.register(Measurement)

## Instruction:
Improve performance @ Measurement Admin
## Code After:
from django.contrib import admin
from .models import Measurement


class MeasurementAdmin(admin.ModelAdmin):
    model = Measurement

    def get_queryset(self, request):
        return super(MeasurementAdmin, self).get_queryset(request).select_related('patient__user')

admin.site.register(Measurement, MeasurementAdmin)
