On 08/21/2013 12:44 PM, Roland van Laar wrote:
Hello,
TLDR: An error message with more information to easily fix the problem.
I got this error message:
django.db.utils.DatabaseError: value too long for type character
varying(100)
What I want is to fix this error in my code as quickly as possible.
Now I need to dig through the stacktrace,
find out which model is saved,
get the model definition,
check the CharFields for length=100 and
apply fix.
The error message is because there is a model with a CharField of length
100.
I would like to know which Model and Field caused the error.
Such as: DatabaseError: own_app.models.User.street: value too long for
type character varying(100).
This way, it's easier to fix this bug I had. Django comes with batteries
included,
it should also come with helpfull error messages.
Django knows that it executes a save for a model.
Django should be able to give me this information.
I would gladly make a feature request in the issue tracker for this when
more people
would like to have a better error message.
The problem is that the above error message doesn't come from Django, it
comes from the database library. Modifying the error message to contain
the model and field information will likely be hard. If the error
doesn't contain the field name, then Django doesn't know the problematic
field either.
Improvements to error messages are usually accepted. This idea, too, if
there is a way to actually do it without ugly hacks.
- Anssi
--
You received this message because you are subscribed to the Google Groups "Django
developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
For more options, visit https://groups.google.com/groups/opt_out.