python - how to use array in django -


I have a DB table that has an integer array but how can I add this model to my model? Trying to write it using IntegerField but giving this error when saving it

  int () the argument should be a string or a number, not the 'list  / Pre> 

How do I add this model to my model? I am using this field in my views.py so that I have to add it to my model. any suggestion?

You may be interested in using

They found a list of integers in this way:

  my_ints = [1,2,3,4,5]  

And such a model:

  class MyModel (models.Model): Value = CommaSeparatedIntegerField (max_length = 200)  

Then you my_ints < / Code> can be saved in MyModel like this:

  m = MyModel (value = ',' .my_ints)) m.save ()  

Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -