Hi,

I need to implement the ability to restore deleted entries in the admin.
Django-reversion handles this, but it doesn't seem to work well with
relations : they aren't restored (at least in my tests).

I thought of setting

class MainModel(models.Model):
>     ...
> class RelatedModel(models.Model):
>     fk = models.ForeignKey( 'MainModel', db_constraint=False,
> on_delete=models.DO_NOTHING )


so that the related entries are kept when the main entries are deleted, and
that whenever I restore the MainModel, the RelatedModel will still be there.

I'm not sure if this is a great idea or if this will cause trouble at some
point. The doc says :

> That said, here are some scenarios where you might want to do this:
> - You have legacy data that is not valid.
> - You’re sharding your database.

 and I'm in neither of these scenarios...

I'd love some advice to know whether I'm on the verge of doing something
stupid ;)

Thanks !

Olivier Dalang

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAExk7p1k1p8oPGx-uA-aL4LDeuGKR0U3WXwp6tKX2BViQ39wAg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to