Answer the question
In order to leave comments, you need to log in
Setting relationships for an already existing db in Django?
There is a ready-made Sqlite database, you need to connect it to a Django project, I found how to create models using it , but I just can’t figure out how to register links between models. When I wrote in php I used yii, there the links were written in this form:
public function getCategory(){
return $this->hasOne(Category::className(), ['id' => 'category_id']);
}
company_that_makes_it = models.ForeignKey(
Manufacturer,
on_delete=models.CASCADE,
)
Answer the question
In order to leave comments, you need to log in
Is there a way to add fieldsWhy do you want to do this, what problem do you want to solve?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question