Currently, it only removes content types in scenarios where you either 
rename a model or delete a model. If I rename an App from "app_label1" to 
"app_label2", it doesn't delete content types for "app_label1" and this is 
causing issues where I use ContentType as a GenericForeignKey.

After I renamed an App and ran remove_stale_contenttypes, I had content 
types like the following:
app_label1_Post
app_label2_Post
app_label1_Comment
app_label2_Comment


My Django ticket was closed saying "I don't think that 
`remove_stale_contenttypes` should remove content types for nonexistent 
apps. We don't automatically remove models for nonexistent apps and I don't 
think we should do this with content types. This can also cause a data loss 
for custom content types (not related to real apps)."


May be we can add an optional kwarg to remove_stale_contenttypes command to 
remove all contenttypes that do not have a corresponding model in existing 
apps. That would allow us to use the standard command with that optional 
kwarg while allowing others to keep custom contenttypes. Can you please let 
me how we can add this functionality while respecting others using custom 
contenttypes.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/c306cc5d-4eeb-4324-b210-7017f9269293%40googlegroups.com.

Reply via email to