diff --git a/boards/models/image.py b/boards/models/image.py --- a/boards/models/image.py +++ b/boards/models/image.py @@ -4,6 +4,7 @@ from random import random import time from django.db import models from boards import thumbs +from boards.models.base import Viewable __author__ = 'neko259' @@ -11,9 +12,13 @@ from boards import thumbs IMAGE_THUMB_SIZE = (200, 150) IMAGES_DIRECTORY = 'images/' FILE_EXTENSION_DELIMITER = '.' +HASH_LENGTH = 36 + +CSS_CLASS_IMAGE = 'image' +CSS_CLASS_THUMB = 'thumb' -class PostImage(models.Model): +class PostImage(models.Model, Viewable): class Meta: app_label = 'boards' ordering = ('id',) @@ -43,7 +48,7 @@ class PostImage(models.Model): height_field='height', preview_width_field='pre_width', preview_height_field='pre_height') - hash = models.CharField(max_length=36) + hash = models.CharField(max_length=HASH_LENGTH) def save(self, *args, **kwargs): """ @@ -60,3 +65,19 @@ class PostImage(models.Model): def __str__(self): return self.image.url + def get_view(self): + return '