Add verbose names to bills

Update admin view with filters
Add list data
Add Search
This commit is contained in:
Alexander Hosking 2021-12-03 12:09:01 -05:00
parent 8f6f226654
commit a5e895f9ad
2 changed files with 10 additions and 6 deletions

View File

@ -2,4 +2,8 @@ from django.contrib import admin
from .models import Bill
admin.site.register(Bill)
@admin.register(Bill)
class BillAdmin(admin.ModelAdmin):
list_display = ['name', 'due', 'amount']
list_filter = ('name', 'type', 'is_paid', 'is_overdue', 'is_missed')
search_fields = ['name', 'type', 'amount']

View File

@ -2,14 +2,14 @@ from django.db import models
# Create your models here.
class Bill(models.Model):
name = models.CharField(max_length=64)
type = models.CharField(max_length=64)
name = models.CharField(max_length=64, verbose_name='Name')
type = models.CharField(max_length=64, verbose_name="Type")
due = models.DateField('due_date')
amount = models.FloatField(default='00.00')
is_paid = models.BooleanField(default=False)
is_paid = models.BooleanField(default=False, verbose_name="Paid")
paid_date = models.DateField('paid_date',null=True, blank=True)
is_overdue = models.BooleanField(default=False)
is_missed = models.BooleanField(default=False)
is_overdue = models.BooleanField(default=False, verbose_name="Overdue")
is_missed = models.BooleanField(default=False, verbose_name='Missed Payment')
def overdue(self):
return self.is_overdue