Open karthikbgl opened 10 years ago
Hi @karthikbgl,
I couldn't reproduce this bug. I added a couple tests for m2m fields, please see afaae0d9467c1af6777ceb55b8e7cdb2b01bdb3e. Did I cover your bug or is it another scenario?
Hi @igorsobreira
Thank you for the quick response. My scenario is:
class ModelAConfigInline():
model = ModelAConfig
class ModelAAdmin(ClonableModelAdmin):
inlines = [ModelAConfigInline]
and the model relationships:
class ModelAConfig(models.Model):
premiums = models.ForeignKey(PremiumSet, null=True, blank=True)
campaign = models.ForeignKey(ModelA)
#Basically, the reverse foreign key relationship.
My apologies for not giving enough details upfront.
I'm a bit confused. You mentioned Many to Many relationship in the issue but this code sample has a One to Many.
When you are editing a ModelA
object and click Clone, all django-modelclone does is give you a form pre-filled so you can create a new ModelA
; and if the original ModelA
had inlines, that is ModelAConfig
s referencing it, your clone form will have pre-filled inline forms to create new ModelAConfig
objects, that will reference the new ModelA
.
Lets say there is a validation error on the object to be cloned, if the object has any many to many fields, it loses the reference to those.