django-bootstrap-modal-forms icon indicating copy to clipboard operation
django-bootstrap-modal-forms copied to clipboard

How to add Foreign key field in BSModalModelForm?

Open alikhan126 opened this issue 5 years ago • 0 comments
trafficstars

Form.py class OwnerForm(BSModalModelForm): class Meta: model = CompanyOwner fields = ['name', 'filing_type', 'outside_income', 'basis_percentage']

models.py class CompanyOwner(Base): company = models.ForeignKey(Company, on_delete=models.DO_NOTHING) name = models.CharField(max_length=250, default="") user = models.ForeignKey(User, on_delete=models.DO_NOTHING, null=True, blank=True) filing_type = models.CharField(max_length=50, choices=choices.FILING_TYPE, default="single") outside_income = models.IntegerField(null=True) basis_percentage = models.IntegerField(default=100, help_text='To add a non-owner, set basis to 0%')

class UserSettings(Base): user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.DO_NOTHING, primary_key=True) **rpt_freq** = models.CharField(max_length=25, choices=choices.REPORT_CHOICES, default="quarterly") receiveReports = models.BooleanField(default=True) phone = models.CharField(max_length=25, default="")

I want to show rpt_freq in OwnerForm Can you tell me how to do that?

alikhan126 avatar Sep 04 '20 21:09 alikhan126