Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify a default value for Django's TextField in South?

I added a TextField to a model whose corresponding table had already been created in the database. As I ran South, I got the following message:

Since you are adding this field, you MUST specify a default value to use for existing rows. Would you like to: 1. Quit now, and add a default to the field in models.py 2. Specify a one-off value to use for existing columns now

I selected choice 2) and gave it a default string value. But no matter what string values I gave, it just responded "Invalid Choice".

Am I doing anything wrong in specifying a default value for TextField in South? Or is this a bug?

Thanks.

like image 545
tamakisquare Avatar asked Dec 21 '25 07:12

tamakisquare


1 Answers

It seems the only time when South says "Invalid choice" is when it asks to choose option 1. or 2. and you enter invalid number.

like image 132
Andrey Fedoseev Avatar answered Dec 22 '25 20:12

Andrey Fedoseev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!