0
我想設計模式,將支持以下內容:Django的模型體系
不同類型的帳戶
每個帳戶都有所特有的每個賬戶類型
有什麼喜好的多組最靈活的方式來設計模型?
例子:
Account Type Swimmer
Location
Email
ID
Preferences
Swimming
Lake
Sea
Running
Beach
Bike
Road
Account Type Doctor
Location
Email
ID
Preferences
Reading
Magazines
Food
Veggies
Account Type Runner
Location
Email
ID
Preferences
Swimming
Ocean
TV
Sports Channels
model.py
class Account (models.Model):
#common account attributes such as email, name
ACCOUNT_CHOICES = (
("swimmer", "Swimmer"),
("doctor", "Doctor"),
)
class PreferencesSwimmer(Account):
#Swimmer's Preferences
class PreferencesDoctor(Account):
#Doctor's Preferences