from django.contrib import admin
from .models import StockState


class StockStateAdmin(admin.ModelAdmin):
    model = StockState
    list_display = [
        'section_id',
        'case_id',
        'product_id',
        'stock_on_hand',
        'daily_consumption',
        'last_modified_date'
    ]
    list_filter = [
        'section_id',
        'case_id',
        'product_id',
        'last_modified_date'
    ]

admin.site.register(StockState, StockStateAdmin)

from django.contrib import admin
from .models import StockState


class StockStateAdmin(admin.ModelAdmin):
    model = StockState
    list_display = [
        'section_id',
        'case_id',
        'product_id',
        'stock_on_hand',
        'daily_consumption',
        'last_modified_date'
    ]
    list_filter = [
        'section_id',
        'last_modified_date'
    ]
    search_fields = ["case_id", "product_id"]


admin.site.register(StockState, StockStateAdmin)

Use product/case id's in search rather than filter
Use product/case id's in search rather than filter

  from django.contrib import admin
  from .models import StockState
  
  
  class StockStateAdmin(admin.ModelAdmin):
      model = StockState
      list_display = [
          'section_id',
          'case_id',
          'product_id',
          'stock_on_hand',
          'daily_consumption',
          'last_modified_date'
      ]
      list_filter = [
          'section_id',
-         'case_id',
-         'product_id',
          'last_modified_date'
      ]
+     search_fields = ["case_id", "product_id"]
+ 
  
  admin.site.register(StockState, StockStateAdmin)
  
Use product/case id's in search rather than filter
## Code Before:
from django.contrib import admin
from .models import StockState


class StockStateAdmin(admin.ModelAdmin):
    model = StockState
    list_display = [
        'section_id',
        'case_id',
        'product_id',
        'stock_on_hand',
        'daily_consumption',
        'last_modified_date'
    ]
    list_filter = [
        'section_id',
        'case_id',
        'product_id',
        'last_modified_date'
    ]

admin.site.register(StockState, StockStateAdmin)

## Instruction:
Use product/case id's in search rather than filter
## Code After:
from django.contrib import admin
from .models import StockState


class StockStateAdmin(admin.ModelAdmin):
    model = StockState
    list_display = [
        'section_id',
        'case_id',
        'product_id',
        'stock_on_hand',
        'daily_consumption',
        'last_modified_date'
    ]
    list_filter = [
        'section_id',
        'last_modified_date'
    ]
    search_fields = ["case_id", "product_id"]


admin.site.register(StockState, StockStateAdmin)
