Tuesday, April 14, 2015

Changing module as per CSV content

Hi,

I have following CSV file :

Sample #,Gender,Handedness
1,Female,Right-handed
2,Male,Left-handed
3,Female,Right-handed
4,Male,Right-handed

Models.py :

class CsvStore(models.Model):

sample_number = models.IntegerField(null = True)
gender = models.CharField(max_length=6)
handedness = models.CharField(max_length=12)


Question : Can we change our model if content of csv file changes ?
Is it possible ?

suppose if CSV i upload has :


Sample #,Gender,Handedness,Age
1,Female,Right-handed, 23
2,Male,Left-handed,24
3,Female,Right-handed,35
4,Male,Right-handed,34

The above model wont work .

Thanks for help.

Kishan Mehta

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAC5ThKGWpkiyy%3DK1doWncF1gkeVNM24ShbGOQOLrpN%2BBMkNKuw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment