From b88372f0327976c31e6b508b26729bab60743f82 Mon Sep 17 00:00:00 2001 From: bnewbold Date: Tue, 6 Feb 2007 23:34:08 -0800 Subject: photos app roughed in, style tweaked TODO: search code --- bn_django/photos/manual_import.py | 64 +++++++++++ bn_django/settings.py | 2 +- bn_django/templates/.about.html.swp | Bin 12288 -> 0 bytes bn_django/templates/about.html | 11 +- bn_django/templates/base.html | 14 ++- bn_django/templates/frontpage.html | 66 +++++++++++- bn_django/templates/static/directory_index | 18 ++++ bn_django/templates/static/directory_index.html | 13 --- bn_django/urls.py | 1 + static/style/default.css | 136 +++++++++++------------- 10 files changed, 227 insertions(+), 98 deletions(-) create mode 100644 bn_django/photos/manual_import.py delete mode 100644 bn_django/templates/.about.html.swp create mode 100644 bn_django/templates/static/directory_index delete mode 100644 bn_django/templates/static/directory_index.html diff --git a/bn_django/photos/manual_import.py b/bn_django/photos/manual_import.py new file mode 100644 index 0000000..a9b5448 --- /dev/null +++ b/bn_django/photos/manual_import.py @@ -0,0 +1,64 @@ +# Create your views here. + +# django imports +from django.conf import settings + +# other imports +import zipfile +import os +import stat +import shutil +from datetime import datetime +from tempfile import NamedTemporaryFile, mkdtemp +import Image +try: + from cStringIO import StringIO +except ImportError: + from StringIO import StringIO + +# Handling settings here +STOCKPHOTO_BASE = '/home/bnewbold/bn-project/media/photos' + +# models +from bn_django.photos.models import Gallery, Photo + +# views + + +def manual_import_photos(thezipfile, thegallery): + # Check if the gallery is valid + gallery = thegallery; + + f = file(thezipfile); + zip = zipfile.ZipFile(f) + #date = the_date + #if not date: + date = datetime.date(datetime.now()) + + destdir= os.path.join(settings.MEDIA_ROOT, STOCKPHOTO_BASE, + datetime.strftime(datetime.now(), + "%Y/%m/%d/")) + if not os.path.isdir(destdir): + os.makedirs(destdir, 0775) + for filename in zip.namelist(): + photopath = os.path.join(destdir, os.path.basename(filename)) + data = zip.read(filename) + file_data = StringIO(data) + try: + Image.open(file_data) + except: + # don't save and process non Image files + continue + photo = file(photopath, "wb") + photo.write(data) + + # Create the object + if photopath.startswith(os.path.sep): + photopath = photopath[len(settings.MEDIA_ROOT):] + photo = Photo(image=photopath, date=date, + photographer='Bryan Newbold', + title = os.path.basename(filename), + gallery_id = thegallery) + # Save it -- the thumbnails etc. get created. + photo.save() + return diff --git a/bn_django/settings.py b/bn_django/settings.py index 282f4c9..e8ee891 100644 --- a/bn_django/settings.py +++ b/bn_django/settings.py @@ -38,7 +38,7 @@ MEDIA_ROOT = '/home/bnewbold/bn-project/media/' # URL that handles the media served from MEDIA_ROOT. # Example: "http://media.lawrence.com" -MEDIA_URL = 'http://bryannewbold.com/media/' +MEDIA_URL = '/media/' # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a # trailing slash. diff --git a/bn_django/templates/.about.html.swp b/bn_django/templates/.about.html.swp deleted file mode 100644 index 40f88fd..0000000 Binary files a/bn_django/templates/.about.html.swp and /dev/null differ diff --git a/bn_django/templates/about.html b/bn_django/templates/about.html index eb03970..f8db11a 100644 --- a/bn_django/templates/about.html +++ b/bn_django/templates/about.html @@ -9,7 +9,7 @@ {% block content %}

-

+

the perp
@@ -22,10 +22,17 @@ This website is the web presence of Bryan Newbold.
browsable code repository
so people (including myself!) don't have to rewrite
home for other projects -
like... mmmmm +
like... hhmmmmm
waste of time
(most importantly!)

If you're curious about the technology that runs the site, see the credits. +
+
+
+
+
+
+ {% endblock %} diff --git a/bn_django/templates/base.html b/bn_django/templates/base.html index a87d0a5..84f7ffb 100644 --- a/bn_django/templates/base.html +++ b/bn_django/templates/base.html @@ -12,20 +12,24 @@ bryannewbold.com knowledge  photos  - code  - projects + code +

+
+
+
+ + +
+
{% block path %}{% endblock %}

{% block title %}Hey Hey Hey!{% endblock %}

{% block right_stuff %} -  -hey hey hey hey hey hey hey hey hey hey hey hey hey hey hey hey hey hey hey hey hey hey hey hey hey hey hey hey hey hey -hey hey hey {% endblock %}
diff --git a/bn_django/templates/frontpage.html b/bn_django/templates/frontpage.html index 47a55dd..ac9323c 100644 --- a/bn_django/templates/frontpage.html +++ b/bn_django/templates/frontpage.html @@ -2,13 +2,13 @@ {% block path %}{% endblock %} -{% block title %}Welcome to a brave new bold world!{% endblock %} +{% block title %}A Brave New Bold World!{% endblock %} {% block right_stuff %} -Other sites: : : : : : : : : : : : : : - +Other sites:
+   - athena locker
+   - facebook?
+   - git repository {% endblock %} {% block content %} @@ -26,6 +26,62 @@ Other sites: : : : : : : : : : : : : : There will be more forthcoming ... There will be more forthcoming ... There will be more forthcoming ... +
+ + there is no spoon! there is no spoon! + there is no spoon! there is no spoon! + there is no spoon! there is no spoon! + +
+ There will be more forthcoming ... + There will be more stuff forthcoming ... + There will be more forthcoming ... + There will be more forthcoming ... + There will be more forthcoming ... + There will be more forthcoming ... + There will be more forthcoming ... + There will be more forthcoming ... + There will be more forthcoming ... + +
+
+what if i put more content over here? also, will it wrap correctly? +
+
+
+ There will be more forthcoming ... + There will be more forthcoming ... + There will be more forthcoming ... + There will be more forthcoming ... + There will be more forthcoming ... + There will be more forthcoming ... + There will be more stuff forthcoming ... + There will be more forthcoming ... + There will be more forthcoming ... + There will be more forthcoming ... + There will be more forthcoming ... + There will be more forthcoming ... + There will be more forthcoming ... + There will be more forthcoming ... + There will be more forthcoming ... + There will be more forthcoming ... + There will be more forthcoming ... + There will be more forthcoming ... + There will be more forthcoming ... + There will be more forthcoming ... + There will be more stuff forthcoming ... + There will be more forthcoming ... + There will be more forthcoming ... + There will be more forthcoming ... + There will be more forthcoming ... + There will be more forthcoming ... + There will be more forthcoming ... + There will be more forthcoming ... + There will be more forthcoming ... + There will be more forthcoming ... + There will be more forthcoming ... + There will be more forthcoming ... + There will be more forthcoming ... {% endblock %} diff --git a/bn_django/templates/static/directory_index b/bn_django/templates/static/directory_index new file mode 100644 index 0000000..61e7f02 --- /dev/null +++ b/bn_django/templates/static/directory_index @@ -0,0 +1,18 @@ +{% extends "base.html" %} + +{% block title %} +

Index of /{{ directory }}

+{% endblock %} + +{% block content %} +
+ +
+
+
+ +{% endblock %} diff --git a/bn_django/templates/static/directory_index.html b/bn_django/templates/static/directory_index.html deleted file mode 100644 index 6df279d..0000000 --- a/bn_django/templates/static/directory_index.html +++ /dev/null @@ -1,13 +0,0 @@ -{% extends "base.html" %} - -{% block title %} -

Index of {{ directory }}

-{% endblock %} - -{% block content %} - -{% endblock %} diff --git a/bn_django/urls.py b/bn_django/urls.py index f8b1b62..327e9ec 100644 --- a/bn_django/urls.py +++ b/bn_django/urls.py @@ -17,4 +17,5 @@ urlpatterns = patterns('', (r'^admin/', include('django.contrib.admin.urls')), (r'^static/(?P.*)$', 'django.views.static.serve', {'document_root': '/home/bnewbold/bn-project/static', 'show_indexes': True}), (r'^style/(?P.*)$', 'django.views.static.serve', {'document_root': '/home/bnewbold/bn-project/static/style'}), + (r'^media/(?P.*)$', 'django.views.static.serve', {'document_root': '/home/bnewbold/bn-project/media'}), ) diff --git a/static/style/default.css b/static/style/default.css index f18911e..7c9402e 100644 --- a/static/style/default.css +++ b/static/style/default.css @@ -1,37 +1,25 @@ html { margin: 0px; - padding: 0px; -} - + padding: 0px; } body { font-family: serif; margin: 0px; padding: 0px; - background-color: #EEEEEE; -} - + background-color: #E3E3E3; } a { - text-decoration: none; -} - + text-decoration: none; } h1 { font-size: 16pt; font-weight: bold; - text-align: center; -} - + text-align: center; } h3 { margin: 0px; padding-top: 8px; padding-bottom: 4px; padding-left: 30px; - padding-right: 30px; -} - + padding-right: 30px; } p { - margin: 0px; -} - + margin: 0px; } hr { height: 12px; padding: 2px; @@ -43,63 +31,63 @@ hr { border-top: 5px solid #FFFFFF; border-bottom: 5px solid #FFFFFF; border-left: 55px solid #FFFFFF; - border-right: 55px solid #FFFFFF; -} - + border-right: 55px solid #FFFFFF; } dt { - font-weight: bold; -} - -dd { - position: relative; - left: 25px; -} + font-weight: bold; } +.search_box { + border: 1px solid black; + padding: 1px; + font-size: 12px; + font-weight: bold; + background-color: #F8F8F8; + color: #777777; } .path { font-family: courier; - font-size: smaller; + font-size: 12px; color: #555555; - margin-left: 8px; -} - + font-weight: bold; + font-size: 12px; + margin-left: 8px; } +.path a { + color: #6666DD; } +.path a:visited { + color: #883388; } .righty_content { - margin: 3px; + text-align: center; + margin-top: 5px; + margin-left: 5px; padding: 1px; float: right; width: 30%; -} - + overflow: hidden; } .lefty_content { text-align: center; margin-right: 5px; padding: 1px; float: left; width: 30%; - overflow: hidden; -} - + overflow: hidden; } .lefty_content img { border: 1px solid black; - width: 90%; -} - + width: 90%; } +.righty_content img { + border: 1px solid black; + width: 90%; } .content_caption { text-align: center; font-style: italic; width: 100%; - font-size: smaller; - font-family: courier; -} - -.lefty { - float: left; -} - + font-size: small; + font-family: courier; } +.lefty { + float: left; } .righty { - float: right; -} - + float: right; } +.centerize { + text-align: center; } .content { + font-size: small; background-color: #FFFFFF; margin-left: 4%; width: 680px; @@ -107,15 +95,15 @@ dd { margin-bottom: 0px; padding-left: 5px; padding-right: 5px; - padding-bottom: 5px; -} - + padding-bottom: 5px; } +.content img { + border: 1px solid black; } .content_footer { margin-left: 4%; width: 685px; - font-size: small; + font-size: 10px; font-style: italic; - font-family: courier; + font-family: sans-serif; text-align: center; width: 680px; margin-bottom: 5px; @@ -123,9 +111,7 @@ dd { border-top: 2px solid #000000; padding-top: 6px; padding-left: 5px; - padding-right: 5px; -} - + padding-right: 5px; } .right_stuff { font-size: small; margin-left: 4px; @@ -136,15 +122,25 @@ dd { position: relative; left: 206px; top: -11px; -} + color: #777777; + font-weight: bold; + font-size: 12px; } +.right_stuff a { + color: #7777DD; } +.right_stuff a:visited { + color: #BB77BB; } +.right_stuff img { + border: 1px solid black; } +.photo_thumb { + width: 160px; + height: 180px; } #top_bar { height: 22px; background-color: #993333; margin: 0px; padding: 0px; -} - + width: 100%; } #top_bar_content { background-color: #993333; height: 20px; @@ -153,21 +149,17 @@ dd { color: #EEEEEE; float: center; width: 684px; + border-right: 200px solid #993333; padding-top: 2px; padding-bottom: 0px; padding-left: 3px; - padding-right: 3px; + padding-right: 5px; margin-left: 4%; margin-bottom: 0px; - margin-top:0px; -} - + margin-top:0px; } #top_bar_content a { font-weight: bold; color: #FFFFFF; - text-decoration: none; -} - + text-decoration: none; } #main_title { - border-top: 5px solid #FFFFFF; -} + border-top: 3px solid #FFFFFF; } -- cgit v1.2.3