aboutsummaryrefslogtreecommitdiffstats
path: root/bn_django
diff options
context:
space:
mode:
Diffstat (limited to 'bn_django')
-rw-r--r--bn_django/photos/manual_import.py64
-rw-r--r--bn_django/settings.py2
-rw-r--r--bn_django/templates/.about.html.swpbin12288 -> 0 bytes
-rw-r--r--bn_django/templates/about.html11
-rw-r--r--bn_django/templates/base.html14
-rw-r--r--bn_django/templates/frontpage.html66
-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.py1
8 files changed, 151 insertions, 14 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
deleted file mode 100644
index 40f88fd..0000000
--- a/bn_django/templates/.about.html.swp
+++ /dev/null
Binary files 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 %}
<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>&nbsp;
<a href="/photos">photos</a>&nbsp;
- <a href="/code">code</a>&nbsp;
- <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="&nbsp;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 %}
-&nbsp;
-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 />
+ &nbsp; - <a href="http://web.mit.edu/bnewbold/www"> athena locker</a><br />
+ &nbsp; - <a href="http://facebook.com/"> facebook?</a><br />
+ &nbsp; - <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'}),
)