web2py

Showing flash messages in DJango with close button

Showing flash messages in DJango with close button Question: I want to display flash messages in Django with the close button. Existing message framework in Django allows to display messages and does not allow to close it. As an example, web2py provides such flash messages. I am looking for similar functionality in Django. If it …

Total answers: 6

"object of type 'NoneType' has no len()" error

"object of type 'NoneType' has no len()" error Question: I’m seeing weird behavior on this code: images = dict(cover=[],second_row=[],additional_rows=[]) for pic in pictures: if len(images[‘cover’]) == 0: images[‘cover’] = pic.path_thumb_l elif len(images[‘second_row’]) < 3: images[‘second_row’].append(pic.path_thumb_m) else: images[‘additional_rows’].append(pic.path_thumb_s) My web2py app gives me this error: if len(images[‘cover’]) == 0: TypeError: object of type ‘NoneType’ has no …

Total answers: 4