How to change type of field in model, when database is already populated ?

2015-05-16 Thread mangu rajpurohit
Hi, I am new to Django. I am working on an application ,where the types of table fields in database are not known before hand. So, say for eg. In student table, I am assigning CharField to marks field, ie class Student(models.Model): marks = model.CharField(max_length = 3) and after Stude

Re: How to change type of field in model, when database is already populated ?

2015-05-16 Thread Sergiy Khohlov
Dump your data in the SQL file. Of course , separate structure and data. Update structure. Verify ability to switch into digit. If you have using Digit as string in dump you can update data manually or by see or ask. If previous data contains char then no chances. 16 трав. 2015 16:26 "mangu rajpuro

Re: How to change type of field in model, when database is already populated ?

2015-05-17 Thread donarb
On Saturday, May 16, 2015 at 6:26:32 AM UTC-7, mangu rajpurohit wrote: > > Hi, > > I am new to Django. I am working on an application ,where the types of > table fields in database are not known before hand. So, say for eg. In > student table, I am assigning CharField to marks field, ie > > class

Re: How to change type of field in model, when database is already populated ?

2015-05-18 Thread Larry Martell
On Sat, May 16, 2015 at 9:26 AM, mangu rajpurohit wrote: > Hi, > > I am new to Django. I am working on an application ,where the types of table > fields in database are not known before hand. So, say for eg. In student > table, I am assigning CharField to marks field, ie > > class Student(models.M

Re: How to change type of field in model, when database is already populated ?

2015-05-18 Thread Galia Ladiray
>From django 1.7 it is done by the migration Change your Models class run makemigrations, it will recognise the change and create a migration file run migrate command, which will alter the database On Saturday, May 16, 2015 at 3:26:32 PM UTC+2, mangu rajpurohit wrote: > > Hi, > > I am new to Dja