Hi Gowtham

My Django ticket was closed
>

Please link to the ticket here.

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
> appsv
>

That sounds somewhat reasonable to me. I think there are more implications
for renaming an app pthough. Wouldn't it be better when renaming an app to
add a migration to update the existing ContentType rows to point to the new
names? Then existing rows with Generic Foreign Key should continue to work?

On Tue, 31 Dec 2019 at 07:11, gowtham kommineni <gowtham...@gmail.com>
wrote:

> 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
> <https://groups.google.com/d/msgid/django-developers/c306cc5d-4eeb-4324-b210-7017f9269293%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Adam

-- 
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/CAMyDDM1NCQaf%3D0EP12DW9xn7h%3Dd%3DB-UBQ%2BzYeHucjH-5zk0vXQ%40mail.gmail.com.

Reply via email to