Advertisement
Guest User

Untitled

a guest
Feb 10th, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. class SupplierAccountInline(admin.TabularInline):
  2. model = SupplierAccount
  3.  
  4.  
  5. @admin.register(EUser)
  6. class EUserAdmin(admin.ModelAdmin):
  7. list_display = ('user', 'temp_user', 'service_type', 'address', 'online_account', )
  8. inlines = [SupplierAccountInline, ]
  9.  
  10. class EUser(models.Model):
  11. alpha_supplier = models.OneToOneField(SupplierAccount, related_name='gas_account', null=True)
  12. beta_supplier = models.OneToOneField(SupplierAccount, related_name='power_account', null=True)
  13. combined_supplier = models.OneToOneField(SupplierAccount, null=True)
  14. address = models.ForeignKey(Address, null=True)
  15. temp_user = models.CharField(max_length=255, null=True)
  16. user = models.OneToOneField(settings.AUTH_USER_MODEL, null=True, default=None)
  17.  
  18. class SupplierAccount(models.Model):
  19. supplier = models.ForeignKey(Supplier)
  20. username = models.CharField(max_length=255, null=True)
  21. password = models.CharField(max_length=255, null=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement