-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Index error - string index out of range #12
Comments
Do you use the latest version of the package? |
Could you describe to me what have you exactly done in this example? I guess your field is not required. Did you post an empty form? Is your field read-only or did you typed something in the form field manually? More info could be useful in resolving this issue. |
Just share any information that you think may be useful in reproducing this bug and then resolving this issue. |
Dear Szymon,
I went ahead without the location field for my initial work. I'm planning
to start rework on the same this week and hopefully will include location
field in the same. I will come back to you for any support.
Thanks for following.
Regards
Jay
…On Wed, Jul 8, 2020 at 4:33 PM Szymon Kowaliński ***@***.***> wrote:
Just share any information that you think may be useful in reproducing
this bug and then resolving this issue.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#12 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/APPJLPHSR4FJYVWT6JBXZR3R2RG7LANCNFSM4NZPP5IA>
.
|
Okay. I'm closing this issue, but you can reopen it if you encounter the same bug or open a new one whenever my package causes any troubles. Good luck with your project! |
@suyashgithub Of course, the try-except block eliminates error raising, but it probably doesn't eliminate the cause of this problem. It's a remedy only for symptoms of an issue. The get_prep_value() function is a crucial part of Django's field behavior (it converts the python value to the one that saved to the database) and the errors there shouldn't be ignored. I worked on a similar case in the #15 issue, but that was about the direct saving of strings to the database. According to your screenshot, your value is an empty string(''), so I guess it should satisfy the isinstance(value, str) if-check and then after self.save_string() affection saved to db without even entering the 45th line. That's why I'm surprised that you still encounter this issue. I can take a closer look, but I need some details e.g. what's your configuration and what are you doing. I tried posting an empty form to a nullable field on my local machine and everything worked as expected. |
I am using in my model i am using like this way from mapbox_location_field.models import LocationField |
When exactly do you see this error? Are you doing something unexpected or just post a form? I'm asking because everything is wired. Your field is not nullable, but the value you have is an empty string? Apart from that, an empty string shouldn't cause an error like this in the latest version of my package. I recommend you to try to run my live demo on your machine to see if this error still raise. |
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further. |
Hello,
I get index error - string index out of range, when I save the form
The text was updated successfully, but these errors were encountered: