I have a model Product
it has two fields size & colours among others
colours = models.CharField(blank=True, null=True, max_length=500) size = models.CharField(blank=True, null=True, max_length=500)
In my view I have
current_product = Product.objects.get(slug=title) if len(current_product.size) != 0 : current_product.size = current_product.size.split(',')
and get this error:
object of type ‘NoneType’ has no len()
What is NoneType and how can I test for it?
NoneTypeis the type that theNonevalue has. You want to change the second snippet to