from django.contrib import admin

from expense.models import ExpenseNote


class ExpenseNoteAdmin(admin.ModelAdmin):
    list_display = ['date', 'save_in_ledger', 'details', 'contact', 'credit_account', 'debit_account', 'amount']
    list_filter = ['date', 'save_in_ledger']
    readonly_fields = ['amount']
    fields = ('date', 'contact', 'number', 'details', 'credit_account', 'debit_account', 'amount', 'save_in_ledger')


admin.site.register(ExpenseNote, ExpenseNoteAdmin)

from django.contrib import admin

from expense.models import ExpenseNote


class ExpenseNoteAdmin(admin.ModelAdmin):
    list_display = ['date', 'save_in_ledger', 'details', 'contact', 'credit_account', 'debit_account', 'amount']
    list_filter = ['date', 'save_in_ledger']
    fields = ('date', 'contact', 'number', 'details', 'credit_account', 'debit_account', 'amount', 'save_in_ledger')


admin.site.register(ExpenseNote, ExpenseNoteAdmin)

Allow editing amount field in expensenote
Allow editing amount field in expensenote

  from django.contrib import admin
  
  from expense.models import ExpenseNote
  
  
  class ExpenseNoteAdmin(admin.ModelAdmin):
      list_display = ['date', 'save_in_ledger', 'details', 'contact', 'credit_account', 'debit_account', 'amount']
      list_filter = ['date', 'save_in_ledger']
-     readonly_fields = ['amount']
      fields = ('date', 'contact', 'number', 'details', 'credit_account', 'debit_account', 'amount', 'save_in_ledger')
  
  
  admin.site.register(ExpenseNote, ExpenseNoteAdmin)
  
Allow editing amount field in expensenote
## Code Before:
from django.contrib import admin

from expense.models import ExpenseNote


class ExpenseNoteAdmin(admin.ModelAdmin):
    list_display = ['date', 'save_in_ledger', 'details', 'contact', 'credit_account', 'debit_account', 'amount']
    list_filter = ['date', 'save_in_ledger']
    readonly_fields = ['amount']
    fields = ('date', 'contact', 'number', 'details', 'credit_account', 'debit_account', 'amount', 'save_in_ledger')


admin.site.register(ExpenseNote, ExpenseNoteAdmin)

## Instruction:
Allow editing amount field in expensenote
## Code After:
from django.contrib import admin

from expense.models import ExpenseNote


class ExpenseNoteAdmin(admin.ModelAdmin):
    list_display = ['date', 'save_in_ledger', 'details', 'contact', 'credit_account', 'debit_account', 'amount']
    list_filter = ['date', 'save_in_ledger']
    fields = ('date', 'contact', 'number', 'details', 'credit_account', 'debit_account', 'amount', 'save_in_ledger')


admin.site.register(ExpenseNote, ExpenseNoteAdmin)
