You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is available for foreign_key fields and reverse many2many fields(related), but I haven't found (maybe badly searched) how to do it for backward one-to-one field access. I mean that:
# models.pyfromdjango.dbimportmodelsclassPerson(models.Model):
name=models.CharField(max_length=256)
classRelatedNamesModel(models.Model):
name=models.CharField(max_length=256)
one_to_one=models.OneToOneField(
Person, related_name="one_related", on_delete=models.CASCADE
)
# reciepts.pyfrommodel_bakery.recipeimportRecipefrommodelsimportPerson, RelatedNamesModelperson=Recipe(Person)
name=Recipe(RelatedNamesModel)
person_with_names=person.extend(one_related=name) # it's not work
Versions
Python: 3.8.3
Django: 3.0.8
Model Bakery: 1.1.1
The text was updated successfully, but these errors were encountered:
This is available for
foreign_key
fields and reverse many2many fields(related
), but I haven't found (maybe badly searched) how to do it for backward one-to-one field access. I mean that:Versions
Python: 3.8.3
Django: 3.0.8
Model Bakery: 1.1.1
The text was updated successfully, but these errors were encountered: