summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/books/admin.py2
-rw-r--r--app/books/models.py17
-rw-r--r--config/settings/settings.py12
3 files changed, 16 insertions, 15 deletions
diff --git a/app/books/admin.py b/app/books/admin.py
index 3f222d8..6ba03ff 100644
--- a/app/books/admin.py
+++ b/app/books/admin.py
@@ -3,7 +3,7 @@ from .models import Book, BookHighlight
class BookAdmin(admin.ModelAdmin):
- list_display = ('title', 'isbn', 'author_name', 'read_date')
+ list_display = ('title', 'admin_thumbnail', 'isbn', 'author_name', 'read_date')
class BookHighlightAdmin(admin.ModelAdmin):
diff --git a/app/books/models.py b/app/books/models.py
index 7af5d5c..cfa8379 100644
--- a/app/books/models.py
+++ b/app/books/models.py
@@ -1,4 +1,6 @@
from django.db import models
+from django.utils.encoding import force_text
+from django.conf import settings
from django.template.defaultfilters import slugify
from taggit.managers import TaggableManager
@@ -10,13 +12,9 @@ class Book(models.Model):
year_pub = models.CharField(max_length=4, blank=True, null=True)
read_date = models.DateTimeField()
isbn = models.CharField(max_length=100, blank=True, null=True)
-
body_html = models.TextField(null=True, blank=True)
-
url = models.CharField(max_length=200, blank=True, null=True)
-
- #tags = TaggableManager(blank=True, null=True)
- tags = models.CharField(max_length=200, blank=True, null=True)
+ tags = TaggableManager()
RATINGS = (
('1', "1 Star"),
('2', "2 Stars"),
@@ -26,6 +24,7 @@ class Book(models.Model):
)
rating = models.CharField(max_length=1, choices=RATINGS, null=True)
enable_comments = models.BooleanField(default=False)
+ image = models.FileField(upload_to='book-covers/', null=True, blank=True)
class Meta:
ordering = ('-read_date',)
@@ -33,6 +32,14 @@ class Book(models.Model):
def __str__(self):
return self.title
+ def get_image_url(self):
+ return '/media/%s' % (self.image)
+
+ def admin_thumbnail(self):
+ return force_text('<a href=""><img src="%s" width="100" style="width:100px"></a>' % (self.get_image_url()))
+ admin_thumbnail.allow_tags = True
+ admin_thumbnail.short_description = 'Thumbnail'
+
def save(self, *args, **kwargs):
self.slug = slugify(self.title[:50])
super(Book, self).save()
diff --git a/config/settings/settings.py b/config/settings/settings.py
index 4af223c..9896c7a 100644
--- a/config/settings/settings.py
+++ b/config/settings/settings.py
@@ -1,7 +1,7 @@
import os
from os.path import dirname, abspath
-PROJ_ROOT = abspath(dirname(dirname(dirname(__file__))))+'/'
+PROJ_ROOT = abspath(dirname(dirname(dirname(__file__)))) + '/'
DEBUG = True
TEMPLATE_DEBUG = DEBUG
@@ -26,7 +26,6 @@ TIME_ZONE = 'America/New_York'
LANGUAGE_CODE = 'en-us'
SITE_ID = 1
SITE_URL = 'http://luxagraf.net/'
-GRAPPELLI_ADMIN_TITLE = 'Luxagraf Admin'
USE_I18N = False
USE_L10N = True
USE_TZ = False
@@ -39,10 +38,6 @@ EMAIL_HOST_PASSWORD = '^C9XZz55UJ@j2@5XNU'
EMAIL_PORT = 587
-#API key for Google Maps in Admin
-MAP_API = "google"
-GOOGLE_MAPS_API_KEY = MAP_API_KEY = 'ABQIAAAAEZ0Oz7LFDmdS1OBHm6HLgRQT5Lr-mnFT_29u-YVgAYs_K_u6-BQ627CkPKq44oaHpmSt2497hDj_LQ'
-
# API key for Flickr imports
FLICKR_API_KEY = '7b9d978a440c6ab65a545adc0aa0d693'
FLICKR_API_SECRET = '42ad60f04745cd9b'
@@ -93,7 +88,6 @@ STATICFILES_DIRS = (
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
-# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
# Make this unique, and don't share it with anybody.
@@ -103,7 +97,6 @@ SECRET_KEY = '^gaz8-&amp;iy8z@(nwp#xe1age(t141w-47fh=cv8a7w2=x2=a-&amp;7'
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
-# 'django.template.loaders.eggs.Loader',
)
MIDDLEWARE_CLASSES = (
@@ -139,7 +132,7 @@ TEMPLATE_DIRS = (
)
-INSTALLED_APPS = (
+INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.staticfiles',
'django.contrib.contenttypes',
@@ -162,6 +155,7 @@ INSTALLED_APPS = (
'pages',
'birds',
'books',
+ 'stuff',
'fluent_comments',
'crispy_forms',
'django.contrib.comments',