0% found this document useful (0 votes)
19 views7 pages

Nea Admin Panel

The document defines several Django models for an electricity billing system, including models for bills, customers, branches, demand types, payment options, and payments. Relationships are defined between these models, such as a foreign key from bills to customers and from customers to branches. Choice fields are also defined for common options like years, months, demand descriptions, and payment platforms.

Uploaded by

abhijeet2058
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views7 pages

Nea Admin Panel

The document defines several Django models for an electricity billing system, including models for bills, customers, branches, demand types, payment options, and payments. Relationships are defined between these models, such as a foreign key from bills to customers and from customers to branches. Choice fields are also defined for common options like years, months, demand descriptions, and payment platforms.

Uploaded by

abhijeet2058
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Djago Models

from django.db import models

year_choice = (
('2080', '2080'),
('2079', '2079'),
('2078', '2078'),
('2077', '2077'),
('2076', '2076'),
('2075', '2075'),
('2074', '2074'),
('2073', '2073'),
('2072', '2072'),
('2071', '2071'),
('2070', '2070'),
('2069', '2069'),
('2068', '2068'),
('2067', '2067'),
('2066', '2066'),
('2065', '2065'),
('2064', '2064'),
('2063', '2063'),
('2062', '2062'),
('2061', '2061'),
('2060', '2060'),
('2059', '2059'),
)

month_choice = (
('Baisakh','Baisakh'),
('Jestha','Jestha'),
('Ashar','Ashar'),
('Sharawan','Sharawan'),
('Bhadra','Bhadra'),
('Aswin','Aswin'),
('Kartik','Kartik'),
('Mansir','Mansir'),
('Poush','Poush'),
('Magh','Magh'),
('Falgun','Falgun'),
('Chaitra','Chaitra'),
)

class Bill(models.Model):
bill_date = models.DateField()
bill_year = models.CharField(max_length=25, choices=year_choice)
bill_month = models.CharField(max_length=12, choices=month_choice)

current_reading = models.FloatField()
prev_reading = models.FloatField()
bill_amount = models.FloatField()

customer = models.ForeignKey('customer.Customer',
on_delete=models.CASCADE)

from django.db import models

class Branch(models.Model):
name = models.CharField(max_length=100)
status = models.BooleanField(default=0)

def __str__(self):
return self.name

from django.db import models


from branch.models import Branch

class Customer(models.Model):
sc_no = models.IntegerField()
full_name = models.CharField(max_length=100)
address = models.CharField(max_length=100)
mobile_no = models.CharField(max_length=20, null=True, blank=True)
branch = models.ForeignKey(Branch, on_delete=models.CASCADE)
demand = models.ForeignKey('demand.DemandType', on_delete=models.CASCADE)

def __str__(self):
return self.full_name
class DemandType(models.Model):

description = models.CharField(max_length=50, choices = demand_desc)


status = models.BooleanField(default=0)

def __str__(self):
return self.description

class DemandRate(models.Model):

demand_rate = models.FloatField()
effective_date = models.DateField()
is_current = models.BooleanField(default=False)

demand_type = models.ForeignKey(DemandType, on_delete=models.CASCADE)

def __str__(self):
return self.demand_rate

from django.db import models


from bill.models import Bill

payment_platforms = (
('eSewa','eSewa'),
('Khalti','Khalti'),
('fonePay','fonePay'),
)

class Payment(models.Model):
payment_date = models.DateField()
payment_amount = models.IntegerField()
rebeat_amount = models.IntegerField()
fine_amount = models.IntegerField()

bill = models.ForeignKey(Bill, on_delete=models.CASCADE)

class PaymentOption(models.Model):
name = models.CharField(max_length=100, choices=payment_platforms)
status = models.BooleanField(default=0)
Admin Panel

You might also like