I'm working on a Django project. where I need to map the fields using foreign key.
how to add only one field instead of whole table using foreign key ?
I'm working on a Django project. where I need to map the fields using foreign key.
how to add only one field instead of whole table using foreign key ?
You can implement the __str__ method to specify how it should show the Developer object:
class Developers(models.Model):
# …
def __str__(self):
return self.Developer_Name
Note: normally a Django model is given a singular name, so
Developerinstead of.Developers
Note: normally the name of the fields in a Django model are written in snake_case, not PascalCase, so it should be:
developer_nameinstead of.Developer_Name