Answer the question
In order to leave comments, you need to log in
Which model field to use for the list?
Right now I'm using a CharField. The list looks like this ['1','2','3']. I need to filter by it, i do like this
Master.objects.filter(id__in=self.object.mylist). Django swears like this
invalid literal for int() with base 10: '['. When inserting this list directly
Master.objects.filter(id__in=['1','2','3']), then of course everything works fine. I understand that the matter is in CharField, so the question is, which field is better to use here, or is there an option to clean up the list somehow from unnecessary characters?
Answer the question
In order to leave comments, you need to log in
For a list, it’s more likely then ArrayField
If, of course, you have Django from 1.8 and PostgreSQL in a DBMS
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question