I'm kind of new to webapps and database stuff in general so this might be a dumb question. I want to make a model ("CategoryModel") with a field that points to the primary id of another instance of the model (its parent).
class CategoryModel(models.Model):
parent = models.ForeignKey(CategoryModel)
How do I do this? Thanks!
parentinstead ofparentId, sincemy_category_model.parentwill be an instance ofCategoryModel. Django will automatically create a memberparent_idwhich will be the primary key of the related model. - Scott