I have a this model structue,
ModelA:
model_b = models.ManyToManyField(
ModelB,
blank=True,
)
...
ModelB:
...
Now I want to delete the relationship from ModelA to ModelB using, model_a.model_b.clear() but I want model_b.model_a_set.all() to still retain the ModelB object. It's kinda I want independent OneToMany and ManyToOne relationship. How can I implement it?
PS: In my case ModelB always have relation to a single object of ModelA, if this can reduce the complexity of the implementation.
Looks like you want a fk relation on ModelB
If this is the case (and after migration), you will then populate this field with data from the original m2m field.
Then you are free to remove the original m2m field