class Image(CMSPlugin): FLOATING_NONE = 'none' FLOATING_LEFT = 'left' FLOATING_RIGHT = 'right' FLOATING_CHOICES = ( (FLOATING_NONE, u'Нет'), (FLOATING_LEFT, u'Слева'), (FLOATING_RIGHT, u'Справа'), ) ALIGNMENT_CENTER = 'center' ALIGNMENT_LEFT = 'left' ALIGNMENT_RIGHT = 'right' ALIGNMENT_CHOICES = ( (ALIGNMENT_CENTER, u'Центр'), (ALIGNMENT_LEFT, u'Левый край'), (ALIGNMENT_RIGHT, u'Правый край'), ) src = ImageField(verbose_name=u'Картинка', manual_crop='640x480') floating = models.CharField(u'Обтекание', max_length=5, choices=FLOATING_CHOICES, default=FLOATING_NONE) alignment = models.CharField(u'Расположение', max_length=6, choices=ALIGNMENT_CHOICES, default=ALIGNMENT_CENTER) padding = models.PositiveIntegerField(u'Отступ', default=20) width = models.PositiveIntegerField(u'Ширина', default=640) height = models.PositiveIntegerField(u'Высота', default=640)
class Magnet(models.Model): image = ImageField(null=True, blank=True, manual_crop=get_image_size(), verbose_name=_('Magnet image')) def __unicode__(self): return _('Magnet #%d') % self.pk class Meta: verbose_name = _('Magnet for the customer') verbose_name_plural = _('Magnets for the customers')
class MagnetImage(models.Model): image = ImageField(verbose_name=_('Magnet image'), manual_crop=get_image_size()) def __unicode__(self): return _('Magnet #%d') % self.pk class Meta: verbose_name = _('Image for magnet on main page') verbose_name_plural = _('Images for magnet on main page')
class Photo(models.Model): """ Simple photo item """ gallery = models.ForeignKey(Gallery) title = models.CharField(max_length=255) image = ImageField(validators=[size_validator, extension_validator]) def __str__(self): return self.title
class Photo(models.Model): gallery = models.ForeignKey(Gallery) title = models.CharField(max_length=255) arbitrary_file = FileField(blank=True, null=True) photo_2x3 = ImageField(manual_crop='2:3', blank=True) def __unicode__(self): return self.title
class Image(models.Model): slug = models.SlugField(max_length=10, primary_key=True, blank=True) image = ImageField(manual_crop="") timestamp = models.DateTimeField(default=datetime.now) def get_absolute_url(self): return reverse('imgshare.views.image', args=[self.pk]) def save(self, *args, **kwargs): if not self.slug: self.slug = ''.join(random.sample(string.ascii_lowercase, 6)) super(Image, self).save(*args, **kwargs)
class Post(models.Model): title = models.CharField(u'Название', max_length=142) subtitle = models.CharField(u'Подзаголовок', max_length=142, blank=True) intro = models.TextField(u'Вступление', blank=True) text = HTMLField(u'Текст') image = ImageField(verbose_name=u'Картинка', manual_crop='640x480') class Meta: verbose_name = u'Запись' verbose_name_plural = u'Записи' def __unicode__(self): return self.title
class Image(models.Model): slug = models.SlugField(max_length=10, primary_key=True, blank=True) image = ImageField(manual_crop="") def __repr__(self): return u'<Image slug={0} image={1}>'.format(self.slug, self.image) def save(self, *args, **kwargs): if not self.slug: self.slug = ''.join(random.sample(string.ascii_lowercase, 6)) super(Image, self).save(*args, **kwargs) @models.permalink def get_absolute_url(self): return 'detail', (), {'pk': self.pk}
class MagnetPlugin(CMSPlugin): image = ImageField(null=True, blank=True, manual_crop=get_image_size())