diff --git a/imagehosting/models.py b/imagehosting/models.py index 8da68c2..382bb56 100644 --- a/imagehosting/models.py +++ b/imagehosting/models.py @@ -1,19 +1,19 @@ # -*- coding: utf-8 -*- + from __future__ import unicode_literals from django.db import models from django.utils import timezone -# from ih import images import os class Post(models.Model): name = models.CharField(max_length=30, blank=True) file = models.FileField(upload_to='images') - # thumb = models.CharField(max_length=32, null=True, blank=True) - + thumb_name = property(thumb_name) + orig_name = property(orig_name) + def publish(self): self.published_date = timezone.now() - print(self.__dict__) self.save() def __unicode__(self): @@ -22,21 +22,7 @@ class Post(models.Model): def thumb_name(self): x = os.path.split(self.file.name)[-1] return '/thumb_' + x - - thumb_name = property(thumb_name) - + def orig_name(self): - x = os.path.split(self.file.name)[-1] - return x - - orig_name = property(orig_name) - - '''def resize_image(self.file): - path, file_long = os.path.split(self.file) - - im=image.open(file_long) - size = 128, 128 - im.thumbnail(size) - im.save(thumb_name) - property(resize_image)''' + return x \ No newline at end of file diff --git a/imagehosting/templates/imagehosting/all.html b/imagehosting/templates/imagehosting/all.html index b65dcf5..5b3f92f 100644 --- a/imagehosting/templates/imagehosting/all.html +++ b/imagehosting/templates/imagehosting/all.html @@ -1,38 +1,35 @@ {% extends 'imagehosting/base.html' %} + {% load static %} {% block content%} -
- - + + + + {% endblock content %} diff --git a/imagehosting/templates/imagehosting/base.html b/imagehosting/templates/imagehosting/base.html index 7a36805..4a15b1b 100644 --- a/imagehosting/templates/imagehosting/base.html +++ b/imagehosting/templates/imagehosting/base.html @@ -1,105 +1,114 @@ - - - - - - - - + ul.menu-icon {display: block} + a.right-menu {display: none} + } + - + {% block content %} {% endblock%} - - + +