|
@@ -114,6 +114,7 @@ class ReferencePoint(Point):
|
|
|
class Panorama(ReferencePoint):
|
|
|
loop = models.BooleanField(default=False, verbose_name="360° panorama",
|
|
|
help_text="Whether the panorama loops around the edges")
|
|
|
+ # Panorama
|
|
|
image = models.ImageField(verbose_name="image", upload_to="pano",
|
|
|
width_field="image_width",
|
|
|
height_field="image_height")
|
|
@@ -194,6 +195,17 @@ class Panorama(ReferencePoint):
|
|
|
return "Panorama : " + self.name
|
|
|
|
|
|
|
|
|
+@python_2_unicode_compatible
|
|
|
+class PanoramaPhoto(models.Model):
|
|
|
+ """Photo used to assemble a panorama automatically."""
|
|
|
+ panorama = models.ForeignKey(Panorama, verbose_name="panorama", related_name="photos")
|
|
|
+ # Maybe use a lambda for upload_to, to upload to "photos/<panorama_id>/"
|
|
|
+ photo = models.ImageField(verbose_name="photo", upload_to="photos")
|
|
|
+
|
|
|
+ def __str__(self):
|
|
|
+ return "{} ({})".format(self.panorama.name, self.photo.name)
|
|
|
+
|
|
|
+
|
|
|
class Reference(models.Model):
|
|
|
"""A reference is made of a Panorama, a Reference Point, and the position
|
|
|
(x, y) of the reference point inside the image. With enough
|