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

[((279, 293), 'django.utils.translation.ugettext_lazy', '_', (['"""Shortcode"""'], {}), "('Shortcode')\n", (280, 293), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((355, 368), 'django.utils.translation.ugettext_lazy', '_', (['"""taken at"""'], {}), "('taken at')\n", (356, 368), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((402, 415), 'django.utils.translation.ugettext_lazy', '_', (['"""Username"""'], {}), "('Username')\n", (403, 415), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((469, 480), 'django.utils.translation.ugettext_lazy', '_', (['"""Active"""'], {}), "('Active')\n", (470, 480), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((530, 540), 'django.utils.translation.ugettext_lazy', '_', (['"""Video"""'], {}), "('Video')\n", (531, 540), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((589, 603), 'django.utils.translation.ugettext_lazy', '_', (['"""File Path"""'], {}), "('File Path')\n", (590, 603), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((648, 656), 'django.utils.translation.ugettext_lazy', '_', (['"""URL"""'], {}), "('URL')\n", (649, 656), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((712, 734), 'django.utils.translation.ugettext_lazy', '_', (['"""Created Date/Time"""'], {}), "('Created Date/Time')\n", (713, 734), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((804, 826), 'django.utils.translation.ugettext_lazy', '_', (['"""Updated Date/Time"""'], {}), "('Updated Date/Time')\n", (805, 826), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((885, 897), 'django.utils.translation.ugettext_lazy', '_', (['"""Caption"""'], {}), "('Caption')\n", (886, 897), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((950, 959), 'django.utils.translation.ugettext_lazy', '_', (['"""Tags"""'], {}), "('Tags')\n", (951, 959), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((1115, 1168), 'django.utils.html.mark_safe', 'mark_safe', (['(\'<img src="%s" width="250"  />\' % self.url)'], {}), '(\'<img src="%s" width="250"  />\' % self.url)\n', (1124, 1168), False, 'from django.utils.html import mark_safe\n'), ((1431, 1440), 'django.utils.translation.ugettext_lazy', '_', (['"""Name"""'], {}), "('Name')\n", (1432, 1440), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((1507, 1518), 'django.utils.translation.ugettext_lazy', '_', (['"""Active"""'], {}), "('Active')\n", (1508, 1518), True, 'from django.utils.translation import ugettext_lazy as _\n')]