diff options
-rw-r--r-- | bn_django/photos/manual_import.py | 64 | ||||
-rw-r--r-- | bn_django/settings.py | 2 | ||||
-rw-r--r-- | bn_django/templates/.about.html.swp | bin | 12288 -> 0 bytes | |||
-rw-r--r-- | bn_django/templates/about.html | 11 | ||||
-rw-r--r-- | bn_django/templates/base.html | 14 | ||||
-rw-r--r-- | bn_django/templates/frontpage.html | 66 | ||||
-rw-r--r-- | bn_django/templates/static/directory_index (renamed from bn_django/templates/static/directory_index.html) | 7 | ||||
-rw-r--r-- | bn_django/urls.py | 1 | ||||
-rw-r--r-- | static/style/default.css | 136 |
9 files changed, 215 insertions, 86 deletions
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 Binary files differdeleted file mode 100644 index 40f88fd..0000000 --- a/bn_django/templates/.about.html.swp +++ /dev/null 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 %} <p /> -<div class="lefty_content"> +<div class="righty_content"> <img src="/static/img/orange_small.jpg" /> <br /> <div class="content_caption">the perp</div> @@ -22,10 +22,17 @@ This website is the web presence of <a href="k/BryanNewbold">Bryan Newbold</a>. <dt /><a href="/code">browsable code repository</a> <dd /> so people (including myself!) don't have to rewrite <dt />home for other projects - <dd /> like... mmmmm + <dd /> like... hhmmmmm <dt />waste of time <dd /> (most importantly!) </dl> <p /> If you're curious about the technology that runs the site, see the <a href="/credits">credits</a>. +<br /> +<br /> +<br /> +<br /> +<br /> +<br /> + {% 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 @@ <span class="lefty"><a href="/">bryannewbold.com</a></span> <span class="righty"><a href="/knowledge">knowledge</a> <a href="/photos">photos</a> - <a href="/code">code</a> - <a href="/projects">projects</a> + <a href="/code">code</a> + <!-- <a href="/projects">projects</a> --> </div> </div> <div class="content" id="main_title"> +<div class="right_stuff"> +<form name="search"> +<br/> +<input class="search_box" type="text" size="20" value=" search!" name="search_text" id="search_text" /> +<span class="righty"></span> +</form> +</div> <span class="path"> {% block path %}{% endblock %} </span> <h1>{% block title %}Hey Hey Hey!{% endblock %}</h1> <div class="right_stuff"> {% 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 %} </div> </div> 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: : : : : : : : : : : : : : -<ul> - <li /><a href="http://web.mit.edu/bnewbold/www">athena locker</a> -</ul> +Other sites: <br /> + - <a href="http://web.mit.edu/bnewbold/www"> athena locker</a><br /> + - <a href="http://facebook.com/"> facebook?</a><br /> + - <a href="http://gitweb.bryannewbold.com"> git repository</a> {% endblock %} {% block content %} @@ -26,6 +26,62 @@ Other sites: : : : : : : : : : : : : : There will be more forthcoming ... There will be more forthcoming ... There will be more forthcoming ... +<div class="righty_content"> +<b> + there is no spoon! there is no spoon! + there is no spoon! there is no spoon! + there is no spoon! there is no spoon! +</b> +</div> + 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 ... + </div></div> +<div class="content" id="main_title"> +<div class="right_stuff"> +what if i put more content over here? also, will it wrap correctly? +</div> +</div> +<div class="content"> + 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.html b/bn_django/templates/static/directory_index index 6df279d..61e7f02 100644 --- a/bn_django/templates/static/directory_index.html +++ b/bn_django/templates/static/directory_index @@ -1,13 +1,18 @@ {% extends "base.html" %} {% block title %} -<h1>Index of {{ directory }}</h1> +<h1>Index of /{{ directory }}</h1> {% endblock %} {% block content %} +<br /> <ul> {% for f in file_list %} <li><a href="{{ f }}">{{ f }}</a></li> {% endfor %} </ul> +<br /> +<br /> +<br /> + {% 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<path>.*)$', 'django.views.static.serve', {'document_root': '/home/bnewbold/bn-project/static', 'show_indexes': True}), (r'^style/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '/home/bnewbold/bn-project/static/style'}), + (r'^media/(?P<path>.*)$', '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; } |