Add verbose names to bills
Update admin view with filters Add list data Add Search
This commit is contained in:
parent
8f6f226654
commit
a5e895f9ad
@ -2,4 +2,8 @@ from django.contrib import admin
|
|||||||
|
|
||||||
from .models import Bill
|
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']
|
@ -2,14 +2,14 @@ from django.db import models
|
|||||||
|
|
||||||
# Create your models here.
|
# Create your models here.
|
||||||
class Bill(models.Model):
|
class Bill(models.Model):
|
||||||
name = models.CharField(max_length=64)
|
name = models.CharField(max_length=64, verbose_name='Name')
|
||||||
type = models.CharField(max_length=64)
|
type = models.CharField(max_length=64, verbose_name="Type")
|
||||||
due = models.DateField('due_date')
|
due = models.DateField('due_date')
|
||||||
amount = models.FloatField(default='00.00')
|
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)
|
paid_date = models.DateField('paid_date',null=True, blank=True)
|
||||||
is_overdue = models.BooleanField(default=False)
|
is_overdue = models.BooleanField(default=False, verbose_name="Overdue")
|
||||||
is_missed = models.BooleanField(default=False)
|
is_missed = models.BooleanField(default=False, verbose_name='Missed Payment')
|
||||||
|
|
||||||
def overdue(self):
|
def overdue(self):
|
||||||
return self.is_overdue
|
return self.is_overdue
|
||||||
|
Loading…
Reference in New Issue
Block a user