Add human readable reference to bills
This commit is contained in:
parent
c41b55573a
commit
658262c599
2 changed files with 7 additions and 1 deletions
|
@ -180,6 +180,12 @@ class Bill(models.Model):
|
||||||
|
|
||||||
valid = models.BooleanField(default=True)
|
valid = models.BooleanField(default=True)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def reference(self):
|
||||||
|
return "{}_{}".format(
|
||||||
|
self.owner.username,
|
||||||
|
self.creation_date.strftime("%Y-%m-%d-%H%M"))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def records(self):
|
def records(self):
|
||||||
bill_records = []
|
bill_records = []
|
||||||
|
|
|
@ -83,5 +83,5 @@ class BillSerializer(serializers.ModelSerializer):
|
||||||
records = BillRecordSerializer(many=True, read_only=True)
|
records = BillRecordSerializer(many=True, read_only=True)
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Bill
|
model = Bill
|
||||||
fields = ['owner', 'total', 'due_date', 'creation_date',
|
fields = ['reference', 'owner', 'total', 'due_date', 'creation_date',
|
||||||
'starting_date', 'ending_date', 'records', 'final']
|
'starting_date', 'ending_date', 'records', 'final']
|
||||||
|
|
Loading…
Reference in a new issue