Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from django.db import models
- class Car(models.Model):
- manufacturer = models.ForeignKey(
- 'Manufacturer',
- on_delete=models.CASCADE,
- )
- # ...
- class Manufacturer(models.Model):
- # ...
- pass
- class PurchPurchaseAccount(models.Model):
- id = models.AutoField(primary_key=True)
- purchase = models.ForeignKey(PurchPurchase, null=True, db_column='purchase', blank=True, on_delete=models.CASCADE) # If "parent" rec gone, delete "child" rec!!!
- paid_from_acct = models.ForeignKey(PurchPaidFromAcct, null=True, db_column='paid_from_acct', blank=True, on_delete=models.PROTECT) # Disallow lookup deletion & do not delete this rec.
- _updated = models.DateTimeField()
- _updatedby = models.ForeignKey(Person, null=True, db_column='_updatedby', blank=True, related_name='acctupdated_by', on_delete=models.SET_NULL) # Person records shouldn't be deleted, but if they are, preserve this PurchPurchaseAccount entry, and just set this person to null.
- def __unicode__(self):
- return str(self.paid_from_acct.display)
- class Meta:
- db_table = u'purch_purchase_account'
Add Comment
Please, Sign In to add comment