i have a db in PostgreSQL which is connecting 2 different tables lets call them TBL1 ( TBL1 is a table for all types ) and TBL2( TBL2 is a table for e.g. cars ), TBL1 and TBL2 have a same column named type, so i have created the foreign key between them. Because i'm not sure if that has anything to do with Django...
So, now in model, i have created ( based on the form ) variable called type = models.ForeignKey('TBL1', db_column='type', related_name='type') and it's returning to me Django object model ForeignKey, which i guess is ok. I would like to show that in a form like select and i don't know how to get the data from TBL1. Is there any way to do this, because i have searched for 2-3 days and trying other options, but non of them did the trick ? I have find out that e.g.
STATUS_CHOICES = (
('new', _('New')),
('purchased', _('Purchased'))
)
status = models.CharField(max_length=200, default='new', choices=STATUS_CHOICES)
Is showing the select in form :
P.S.
Django version is 1.5.4 and Python 2.7 , i have never worked in Django or PostgreSQL, so any help would be appreciated. Regards