У меня есть 2 таблицы: customer
и customer_billing
Как я могу отфильтровать строку customer_aadharnumber
и связать две таблицы (из customer
), чтобы сохранить обновленные customer_billing
информация в базе?
Вот код модели:
class customer(models.Model):
customer_Firstname = models.CharField(max_length = 20, null=True )
customer_Fathername = models.CharField(max_length = 20, null=True)
customer_Aadharnumber = models.CharField(max_length = 12, unique=True)
customer_contact_no = models.CharField(max_length = 20, null=True)
customer_address = models.CharField(max_length = 50, null=True)
customer_advance = models.CharField(max_length = 50, blank=True)
customer_created = models.DateTimeField(null=True,auto_now_add=True)
class Customer_Billing(models.Model):
vehicle_number = models.CharField(max_length = 12, null=True)
customer = models.ForeignKey(customer,on_delete = models.SET_NULL, null=True)
vehicle = models.ForeignKey(vehicle,on_delete = models.SET_NULL, null=True)
product_current_price = models.ForeignKey(product_current_price,on_delete = models.SET_NULL, null=True)
load = models.CharField(max_length = 20, null=True)
empty = models.CharField(max_length = 20, null=True)
Acurate_Mango_Weight = models.CharField(max_length = 20, null=True)
mango_suite = models.CharField(max_length = 20, null=True)
Final_price = models.DecimalField(max_digits=1000, decimal_places=2)