from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.html import mark_safe


# Create your models here.
class Gellifinsta(models.Model):
    class Meta:
        ordering = ['-taken_at_datetime']

    shortcode = models.CharField(_("Shortcode"), max_length=20)
    taken_at_datetime = models.DateTimeField(_("taken at"))
    username = models.CharField(_("Username"), max_length=100)
    is_active = models.BooleanField(_("Active"),default=True)
    is_video = models.BooleanField(_("Video"),default=False)
    file_path = models.CharField(_("File Path"), max_length=500)
    url = models.CharField(_("URL"), max_length=500)
    created_dt = models.DateTimeField(_("Created Date/Time"), auto_now_add=True, null=True)
    updated_dt = models.DateTimeField(_("Updated Date/Time"), auto_now=True, null=True)
    caption = models.TextField(_("Caption"), blank=True, null=True)
    tags = models.TextField(_("Tags"), blank=True, null=True)

    def __str__(self):
        return self.shortcode + ':' + str(self.taken_at_datetime)

    def image_tag(self):
        return mark_safe('<img src="%s" width="250"  />' % (self.url))

    image_tag.short_description = 'Image'

    def tags_spaced(self):
        return self.tags.replace(',',' ')
    tags_spaced.short_description = 'Tags'

class Products(models.Model):
    class Meta:
        ordering = ['name']

    name = models.CharField(_("Name"), max_length=100, unique=True)
    is_active = models.BooleanField(_("Active"),default=True)

    def __str__(self):
        return self.name

[((11, 33, 11, 47), 'django.utils.translation.ugettext_lazy', '_', ({(11, 35, 11, 46): '"""Shortcode"""'}, {}), "('Shortcode')", True, 'from django.utils.translation import ugettext_lazy as _\n'), ((12, 45, 12, 58), 'django.utils.translation.ugettext_lazy', '_', ({(12, 47, 12, 57): '"""taken at"""'}, {}), "('taken at')", True, 'from django.utils.translation import ugettext_lazy as _\n'), ((13, 32, 13, 45), 'django.utils.translation.ugettext_lazy', '_', ({(13, 34, 13, 44): '"""Username"""'}, {}), "('Username')", True, 'from django.utils.translation import ugettext_lazy as _\n'), ((14, 36, 14, 47), 'django.utils.translation.ugettext_lazy', '_', ({(14, 38, 14, 46): '"""Active"""'}, {}), "('Active')", True, 'from django.utils.translation import ugettext_lazy as _\n'), ((15, 35, 15, 45), 'django.utils.translation.ugettext_lazy', '_', ({(15, 37, 15, 44): '"""Video"""'}, {}), "('Video')", True, 'from django.utils.translation import ugettext_lazy as _\n'), ((16, 33, 16, 47), 'django.utils.translation.ugettext_lazy', '_', ({(16, 35, 16, 46): '"""File Path"""'}, {}), "('File Path')", True, 'from django.utils.translation import ugettext_lazy as _\n'), ((17, 27, 17, 35), 'django.utils.translation.ugettext_lazy', '_', ({(17, 29, 17, 34): '"""URL"""'}, {}), "('URL')", True, 'from django.utils.translation import ugettext_lazy as _\n'), ((18, 38, 18, 60), 'django.utils.translation.ugettext_lazy', '_', ({(18, 40, 18, 59): '"""Created Date/Time"""'}, {}), "('Created Date/Time')", True, 'from django.utils.translation import ugettext_lazy as _\n'), ((19, 38, 19, 60), 'django.utils.translation.ugettext_lazy', '_', ({(19, 40, 19, 59): '"""Updated Date/Time"""'}, {}), "('Updated Date/Time')", True, 'from django.utils.translation import ugettext_lazy as _\n'), ((20, 31, 20, 43), 'django.utils.translation.ugettext_lazy', '_', ({(20, 33, 20, 42): '"""Caption"""'}, {}), "('Caption')", True, 'from django.utils.translation import ugettext_lazy as _\n'), ((21, 28, 21, 37), 'django.utils.translation.ugettext_lazy', '_', ({(21, 30, 21, 36): '"""Tags"""'}, {}), "('Tags')", True, 'from django.utils.translation import ugettext_lazy as _\n'), ((27, 15, 27, 70), 'django.utils.html.mark_safe', 'mark_safe', ({(27, 25, 27, 69): '(\'<img src="%s" width="250"  />\' % self.url)'}, {}), '(\'<img src="%s" width="250"  />\' % self.url)', False, 'from django.utils.html import mark_safe\n'), ((39, 28, 39, 37), 'django.utils.translation.ugettext_lazy', '_', ({(39, 30, 39, 36): '"""Name"""'}, {}), "('Name')", True, 'from django.utils.translation import ugettext_lazy as _\n'), ((40, 36, 40, 47), 'django.utils.translation.ugettext_lazy', '_', ({(40, 38, 40, 46): '"""Active"""'}, {}), "('Active')", True, 'from django.utils.translation import ugettext_lazy as _\n')]