diff options
Diffstat (limited to 'app/media/models.py')
-rw-r--r-- | app/media/models.py | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/app/media/models.py b/app/media/models.py index d1ef32a..f8ce3b5 100644 --- a/app/media/models.py +++ b/app/media/models.py @@ -22,7 +22,6 @@ from resizeimage.imageexceptions import ImageSizeError from taggit.managers import TaggableManager -from .readexif import readexif from .utils import resize_image from locations.models import Location, CheckIn @@ -78,19 +77,10 @@ class LuxImage(models.Model): image = models.FileField(blank=True, null=True, upload_to=get_upload_path) title = models.CharField(null=True, blank=True, max_length=300) alt = models.CharField(null=True, blank=True, max_length=300) - photo_credit_source = models.CharField(null=True, blank=True, max_length=300) - photo_credit_url = models.CharField(null=True, blank=True, max_length=300) caption = models.TextField(blank=True, null=True) pub_date = models.DateTimeField(default=datetime.datetime.now) - exif_raw = models.TextField(blank=True, null=True) - exif_aperture = models.CharField(max_length=50, blank=True, null=True) - exif_make = models.CharField(max_length=50, blank=True, null=True) - exif_model = models.CharField(max_length=50, blank=True, null=True) - exif_exposure = models.CharField(max_length=50, blank=True, null=True) - exif_iso = models.CharField(max_length=50, blank=True, null=True) - exif_focal_length = models.CharField(max_length=50, blank=True, null=True) - exif_lens = models.CharField(max_length=50, blank=True, null=True) - exif_date = models.DateTimeField(blank=True, null=True) + photo_credit_source = models.CharField(null=True, blank=True, max_length=300) + photo_credit_url = models.CharField(null=True, blank=True, max_length=300) height = models.CharField(max_length=6, blank=True, null=True) width = models.CharField(max_length=6, blank=True, null=True) point = models.PointField(null=True, blank=True) @@ -98,6 +88,11 @@ class LuxImage(models.Model): is_public = models.BooleanField(default=True) sizes = models.ManyToManyField(LuxImageSize, blank=True, related_name='sizes') sizes_cache = models.CharField(null=True, blank=True, max_length=300) + IMAGE_TYPE = ( + (0, 'Photo'), + (1, 'Sketch'), + ) + image_type = models.IntegerField(choices=IMAGE_TYPE, default=0) class Meta: ordering = ('-pub_date', 'id') @@ -255,9 +250,9 @@ class LuxGallery(models.Model): def get_absolute_url(self): if self.is_public: - return "/photos/galleries/%s" % (self.slug) + return "/image//%s" % (self.slug) else: - return "/photos/galleries/private/%s" % (self.slug) + return None def thumbs(self): lst = [x.image.name for x in self.images.all()] @@ -368,8 +363,6 @@ class LuxAudio(models.Model): @receiver(post_save, sender=LuxImage) def post_save_events(sender, update_fields, created, instance, **kwargs): if created: - if instance.exif_raw == '': - instance = readexif(instance) instance.sizes.add(LuxImageSize.objects.get(slug="tn")) img = Image.open(instance.image.path) instance.height = img.height |