""" Posts views """
#Django
from django.http import HttpResponse

#Utilities

from datetime import datetime

posts = [
    {
      'name': 'Vía Láctea',
      'user': 'C. Vander',
      'timestamp': datetime.now().strftime('%b %dth, %Y - %H:%M hrs'),
      'picture': 'https://picsum.photos/200/200/?image=903',
    },
    {
      'name': 'Mont Black',
      'user': 'Victor Ccorimanya',
      'timestamp': datetime.now().strftime('%b %dth, %Y - %H:%M hrs'),
      'picture': 'https://picsum.photos/200/200/?image=1036',
    },
    {
      'name': 'Nuevo Auditorio',
      'user': 'popop',
      'timestamp': datetime.now().strftime('%b %dth, %Y - %H:%M hrs'),
      'picture': 'https://picsum.photos/200/200/?image=1076',
    },
]


def list_posts(request):
    #List existing pots
    content = []
    for post in posts:
        content.append("""
          <p><strong>{name}</strong></p>
          <p><small>{user} - <i>{timestamp} </i></small></p>
          <figure><img src="{picture}"/></figure>
       """.format(**post))
        return HttpResponse('<br>'.join(content))
