Added class comments, unified formatting.
This commit is contained in:
parent
0fefaf66dd
commit
a2412e88d2
@ -26,6 +26,7 @@ class Place (models.Model):
|
|||||||
"""
|
"""
|
||||||
Place defines a lost place (location, name, description etc.).
|
Place defines a lost place (location, name, description etc.).
|
||||||
"""
|
"""
|
||||||
|
|
||||||
name = models.CharField(max_length=50)
|
name = models.CharField(max_length=50)
|
||||||
submitted_by = models.ForeignKey(
|
submitted_by = models.ForeignKey(
|
||||||
Explorer,
|
Explorer,
|
||||||
@ -46,9 +47,15 @@ def generate_image_upload_path(instance, filename):
|
|||||||
"""
|
"""
|
||||||
Callback for generating path for uploaded images
|
Callback for generating path for uploaded images
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return 'places/' + str(uuid.uuid4())+'.'+filename.split('.')[-1]
|
return 'places/' + str(uuid.uuid4())+'.'+filename.split('.')[-1]
|
||||||
|
|
||||||
class PlaceImage (models.Model):
|
class PlaceImage (models.Model):
|
||||||
|
"""
|
||||||
|
PlaceImage defines an image file object that points to a file in uploads/.
|
||||||
|
Intermediate image sizes are generated as defined in SIZES.
|
||||||
|
PlaceImage references a Place to which it belongs.
|
||||||
|
"""
|
||||||
|
|
||||||
SIZES=(
|
SIZES=(
|
||||||
{'code': 'thumbnail', 'wxh': '390x390'},
|
{'code': 'thumbnail', 'wxh': '390x390'},
|
||||||
@ -80,6 +87,7 @@ class PlaceImage (models.Model):
|
|||||||
Returning the name of the corresponding place + id
|
Returning the name of the corresponding place + id
|
||||||
of this image as textual represntation of this instance
|
of this image as textual represntation of this instance
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return ' '.join([self.place.name, str(self.pk)])
|
return ' '.join([self.place.name, str(self.pk)])
|
||||||
|
|
||||||
# These two auto-delete files from filesystem when they are unneeded:
|
# These two auto-delete files from filesystem when they are unneeded:
|
||||||
|
Loading…
Reference in New Issue
Block a user