--
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-develop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/26478a0a-5809-449f-b17d-d7223e2cfb3do%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CABD5YeFdA95UhJex%2BERf1pM-groRiUjO5tyLv300wSRjcWkGSQ%40mail.gmail.com.
How can a class name be more than 100 characters? Can you give an example?A limit of 100 characters seems reasonable to me, maybe even 60 would be enough.
On Tue, Aug 11, 2020 at 6:06 AM Richard Campen <richar...@gmail.com> wrote:
--HelloI have hit what I feel is an arbitrary limit on the length of a django model class name. I am using the PostgreSQL backend, which smartly truncates table names above a certain size (normally 63 characters) which means in theory a table name can be of indeterminate length, as PostgreSQL will truncate it appropriately. However, if the model class name is greater than 100 characters than an error is thrown when saving the model name to the `django_content_type` model as the `ContentType.model` field uses a CharField with a limit of 100. This arbitrarily restricts the size of the model name when the db backend can handle it fine.
I tried to go back in time to figure out if there was any context in setting the `ContentType.model` field max_length at 100 chars, but it was made before the Django project was migrated to git.I feel it would be best to switch this field to a TextField, as even 255 characters seems an unreasonable limit to impose when the db backend can support longer names, though perhaps having a smaller (but configurable) max_length on the TextField would still be desirable.
What are peoples feelings on this?Cheers,Richard
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-d...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/396d07c8-060d-4d35-98eb-e5bbea502a24o%40googlegroups.com.
It does seem unreasonable. I think a migration to TextField would be warranted.You should be able to work around this for now with a migration in your own app that uses RunSQL to alter the column for ContentType.model.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/396d07c8-060d-4d35-98eb-e5bbea502a24o%40googlegroups.com.
--Adam