I'm trying to add an instance of a model in Django to a list and get these results (from Shell):
- Import the model and instantiate an object
>>> from base.models import Service
>>> s = Service.objects.first()
- Check the type of the object
>>> type(s)
<class 'base.models.Service'>
- Instantiate the list
>>> mylist = []
- Try to add the model object to the list
>>> mylist += s
- Error
Traceback (most recent call last):
File "<console>", line 1, in <module>
TypeError: 'Service' object is not iterable
Why exactly can I not add a model instance to the list?