├── __init__.py
├── www
├── __init__.py
├── templatetags
│ ├── __init__.py
│ └── menu_extras.py
├── templates
│ ├── 500.html
│ ├── home.html
│ ├── flatpages
│ │ └── default.html
│ ├── projects.html
│ └── base.html
├── urls.py
├── utils.py
├── views.py
├── context_processors.py
├── admin.py
└── models.py
├── .gitignore
├── media
├── images
│ ├── full6.jpg
│ ├── info_02.jpg
│ ├── nordic.gif
│ ├── streck.gif
│ ├── thumb6.jpg
│ ├── gallery1.jpg
│ ├── gallery2.jpg
│ ├── gallery3.jpg
│ ├── logo_bad.jpg
│ ├── logo_vagg.jpg
│ ├── thumbnail.jpg
│ ├── full-image.jpg
│ ├── logo_angel.jpg
│ ├── logo_brygga.jpg
│ ├── logo_kyrka.jpg
│ ├── logo_oland.jpg
│ ├── logo_utsikt.jpg
│ ├── gallery1.thumb.jpg
│ ├── gallery2.thumb.jpg
│ ├── gallery3.thumb.jpg
│ ├── lightbox-blank.gif
│ ├── lightbox-btn-next.gif
│ ├── lightbox-btn-prev.gif
│ ├── lightbox-btn-close.gif
│ └── lightbox-ico-loading.gif
├── project_photos
│ ├── 0000
│ │ ├── 0075.JPG
│ │ ├── 0075_JPG_120x120_q85.jpg
│ │ └── 0075_JPG_800x600_q85.jpg
│ ├── 001L
│ │ ├── dress1.jpg
│ │ ├── dress1_jpg_120x120_q85.jpg
│ │ └── dress1_jpg_800x600_q85.jpg
│ ├── 003L
│ │ ├── DRESS_847.jpg
│ │ ├── DRESS_847_jpg_120x120_q85.jpg
│ │ └── DRESS_847_jpg_800x600_q85.jpg
│ └── 002L
│ │ ├── dress45large.jpg
│ │ ├── dress45large_jpg_120x120_q85.jpg
│ │ └── dress45large_jpg_800x600_q85.jpg
├── javascript
│ ├── jquery.lightbox-0.5.js
│ ├── jquery.bgiframe.min.js
│ ├── hoverIntent.js
│ ├── supersubs.js
│ ├── superfish.js
│ ├── jquery.lightbox-0.5.pack.js
│ ├── jquery.lightbox-0.5.min.js
│ └── jquery-1.3.min.js
├── jquery-lightbox-0.5
│ ├── photos
│ │ ├── image1.jpg
│ │ ├── image2.jpg
│ │ ├── image3.jpg
│ │ ├── image4.jpg
│ │ ├── image5.jpg
│ │ ├── thumb_image1.jpg
│ │ ├── thumb_image2.jpg
│ │ ├── thumb_image3.jpg
│ │ ├── thumb_image4.jpg
│ │ └── thumb_image5.jpg
│ ├── index.htm
│ └── js
│ │ └── jquery.js
└── css
│ ├── text.css
│ ├── superfish-vertical.css
│ ├── superfish-navbar.css
│ ├── jquery.lightbox-0.5.css
│ └── superfish.css
├── README.txt
├── manage.py
├── urls.py
├── settings.py.default
└── settings.py
/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/www/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | settings_local.py
2 |
--------------------------------------------------------------------------------
/www/templatetags/__init__.py:
--------------------------------------------------------------------------------
1 | #
--------------------------------------------------------------------------------
/media/images/full6.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/images/full6.jpg
--------------------------------------------------------------------------------
/media/images/info_02.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/images/info_02.jpg
--------------------------------------------------------------------------------
/media/images/nordic.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/images/nordic.gif
--------------------------------------------------------------------------------
/media/images/streck.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/images/streck.gif
--------------------------------------------------------------------------------
/media/images/thumb6.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/images/thumb6.jpg
--------------------------------------------------------------------------------
/media/images/gallery1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/images/gallery1.jpg
--------------------------------------------------------------------------------
/media/images/gallery2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/images/gallery2.jpg
--------------------------------------------------------------------------------
/media/images/gallery3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/images/gallery3.jpg
--------------------------------------------------------------------------------
/media/images/logo_bad.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/images/logo_bad.jpg
--------------------------------------------------------------------------------
/media/images/logo_vagg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/images/logo_vagg.jpg
--------------------------------------------------------------------------------
/media/images/thumbnail.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/images/thumbnail.jpg
--------------------------------------------------------------------------------
/README.txt:
--------------------------------------------------------------------------------
1 | GIT
2 | ===
3 |
4 | To push changes to github, use:
5 |
6 | $ git push github master
7 |
8 |
--------------------------------------------------------------------------------
/media/images/full-image.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/images/full-image.jpg
--------------------------------------------------------------------------------
/media/images/logo_angel.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/images/logo_angel.jpg
--------------------------------------------------------------------------------
/media/images/logo_brygga.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/images/logo_brygga.jpg
--------------------------------------------------------------------------------
/media/images/logo_kyrka.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/images/logo_kyrka.jpg
--------------------------------------------------------------------------------
/media/images/logo_oland.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/images/logo_oland.jpg
--------------------------------------------------------------------------------
/media/images/logo_utsikt.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/images/logo_utsikt.jpg
--------------------------------------------------------------------------------
/media/images/gallery1.thumb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/images/gallery1.thumb.jpg
--------------------------------------------------------------------------------
/media/images/gallery2.thumb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/images/gallery2.thumb.jpg
--------------------------------------------------------------------------------
/media/images/gallery3.thumb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/images/gallery3.thumb.jpg
--------------------------------------------------------------------------------
/media/images/lightbox-blank.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/images/lightbox-blank.gif
--------------------------------------------------------------------------------
/media/images/lightbox-btn-next.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/images/lightbox-btn-next.gif
--------------------------------------------------------------------------------
/media/images/lightbox-btn-prev.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/images/lightbox-btn-prev.gif
--------------------------------------------------------------------------------
/media/project_photos/0000/0075.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/project_photos/0000/0075.JPG
--------------------------------------------------------------------------------
/media/images/lightbox-btn-close.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/images/lightbox-btn-close.gif
--------------------------------------------------------------------------------
/media/project_photos/001L/dress1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/project_photos/001L/dress1.jpg
--------------------------------------------------------------------------------
/media/images/lightbox-ico-loading.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/images/lightbox-ico-loading.gif
--------------------------------------------------------------------------------
/media/javascript/jquery.lightbox-0.5.js:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/javascript/jquery.lightbox-0.5.js
--------------------------------------------------------------------------------
/media/project_photos/003L/DRESS_847.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/project_photos/003L/DRESS_847.jpg
--------------------------------------------------------------------------------
/media/jquery-lightbox-0.5/photos/image1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/jquery-lightbox-0.5/photos/image1.jpg
--------------------------------------------------------------------------------
/media/jquery-lightbox-0.5/photos/image2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/jquery-lightbox-0.5/photos/image2.jpg
--------------------------------------------------------------------------------
/media/jquery-lightbox-0.5/photos/image3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/jquery-lightbox-0.5/photos/image3.jpg
--------------------------------------------------------------------------------
/media/jquery-lightbox-0.5/photos/image4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/jquery-lightbox-0.5/photos/image4.jpg
--------------------------------------------------------------------------------
/media/jquery-lightbox-0.5/photos/image5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/jquery-lightbox-0.5/photos/image5.jpg
--------------------------------------------------------------------------------
/media/project_photos/002L/dress45large.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/project_photos/002L/dress45large.jpg
--------------------------------------------------------------------------------
/media/jquery-lightbox-0.5/photos/thumb_image1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/jquery-lightbox-0.5/photos/thumb_image1.jpg
--------------------------------------------------------------------------------
/media/jquery-lightbox-0.5/photos/thumb_image2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/jquery-lightbox-0.5/photos/thumb_image2.jpg
--------------------------------------------------------------------------------
/media/jquery-lightbox-0.5/photos/thumb_image3.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/jquery-lightbox-0.5/photos/thumb_image3.jpg
--------------------------------------------------------------------------------
/media/jquery-lightbox-0.5/photos/thumb_image4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/jquery-lightbox-0.5/photos/thumb_image4.jpg
--------------------------------------------------------------------------------
/media/jquery-lightbox-0.5/photos/thumb_image5.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/jquery-lightbox-0.5/photos/thumb_image5.jpg
--------------------------------------------------------------------------------
/media/project_photos/0000/0075_JPG_120x120_q85.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/project_photos/0000/0075_JPG_120x120_q85.jpg
--------------------------------------------------------------------------------
/media/project_photos/0000/0075_JPG_800x600_q85.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/project_photos/0000/0075_JPG_800x600_q85.jpg
--------------------------------------------------------------------------------
/media/project_photos/001L/dress1_jpg_120x120_q85.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/project_photos/001L/dress1_jpg_120x120_q85.jpg
--------------------------------------------------------------------------------
/media/project_photos/001L/dress1_jpg_800x600_q85.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/project_photos/001L/dress1_jpg_800x600_q85.jpg
--------------------------------------------------------------------------------
/media/project_photos/003L/DRESS_847_jpg_120x120_q85.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/project_photos/003L/DRESS_847_jpg_120x120_q85.jpg
--------------------------------------------------------------------------------
/media/project_photos/003L/DRESS_847_jpg_800x600_q85.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/project_photos/003L/DRESS_847_jpg_800x600_q85.jpg
--------------------------------------------------------------------------------
/media/project_photos/002L/dress45large_jpg_120x120_q85.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/project_photos/002L/dress45large_jpg_120x120_q85.jpg
--------------------------------------------------------------------------------
/media/project_photos/002L/dress45large_jpg_800x600_q85.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/peterbe/arkitektm/master/media/project_photos/002L/dress45large_jpg_800x600_q85.jpg
--------------------------------------------------------------------------------
/www/templates/500.html:
--------------------------------------------------------------------------------
1 | {% extends "base.html" %}
2 |
3 | {% block main %}
4 |
5 |
Fel uppstod
6 | Attans också!
7 | Vi jobbar på det.
8 |
9 | {% endblock %}
10 |
11 |
--------------------------------------------------------------------------------
/www/templates/home.html:
--------------------------------------------------------------------------------
1 | {% extends base_template %}
2 |
3 | {% block maincontent %}
4 | Lite text
5 |
6 |
7 | En massa text text text text text text text text text text text text text
8 | {% endblock %}
9 |
10 |
--------------------------------------------------------------------------------
/media/css/text.css:
--------------------------------------------------------------------------------
1 | body {
2 | font-family:Verdana,Arial,sans-serif;
3 | font-size:10pt;
4 | background-color: #000000;
5 | }
6 |
7 | .style7 {font-size: 12px;}
8 | .style8 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; }
9 |
10 | a#home_link { color:black; }
--------------------------------------------------------------------------------
/www/templates/flatpages/default.html:
--------------------------------------------------------------------------------
1 | {% extends base_template %}
2 | {% load menu_extras %}
3 |
4 | {% block title %}{{ flatpage.title|clean_numbered_title }}{% endblock %}
5 |
6 | {% block maincontent %}
7 | {{ flatpage.title|clean_numbered_title }}
8 |
9 | {{ flatpage.content }}
10 |
11 | {% endblock %}
12 |
--------------------------------------------------------------------------------
/www/urls.py:
--------------------------------------------------------------------------------
1 | from django.conf.urls.defaults import *
2 |
3 | from views import *
4 | from settings import MEDIA_ROOT
5 |
6 | urlpatterns = patterns('',
7 |
8 | # this is now a flatpage instead
9 | #(r'^/?$', home_page),
10 |
11 | url(r'projects/', projects_page),
12 |
13 | (r'^project_photos/(?P.*)$', 'django.views.static.serve',
14 | {'document_root': MEDIA_ROOT + '/project_photos',
15 | 'show_indexes': False}),
16 |
17 |
18 | )
19 |
--------------------------------------------------------------------------------
/manage.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | from django.core.management import execute_manager
3 | try:
4 | import settings # Assumed to be in the same directory.
5 | except ImportError:
6 | import sys
7 | sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__)
8 | sys.exit(1)
9 |
10 | if __name__ == "__main__":
11 | execute_manager(settings)
12 |
--------------------------------------------------------------------------------
/www/utils.py:
--------------------------------------------------------------------------------
1 | # python
2 | import re
3 | import unicodedata
4 |
5 | # django
6 | from django.utils.safestring import mark_safe
7 |
8 | def slugify(value):
9 | """
10 | Normalizes string, removes non-alpha characters,
11 | and converts spaces to hyphens.
12 |
13 | Peter: Copied this from django/template/defaultfilters.py but removed
14 | the lowercasing thing
15 | """
16 | value = unicodedata.normalize('NFKD', value).encode('ascii', 'ignore')
17 | value = unicode(re.sub('[^\w\s-]', '', value).strip())
18 | return mark_safe(re.sub('[\s]+', '_', value))
19 |
20 |
--------------------------------------------------------------------------------
/media/css/superfish-vertical.css:
--------------------------------------------------------------------------------
1 | /*** adding sf-vertical in addition to sf-menu creates a vertical menu ***/
2 | .sf-vertical, .sf-vertical li {
3 | width: 10em;
4 | }
5 | /* this lacks ul at the start of the selector, so the styles from the main CSS file override it where needed */
6 | .sf-vertical li:hover ul,
7 | .sf-vertical li.sfHover ul {
8 | left: 10em; /* match ul width */
9 | top: 0;
10 | }
11 |
12 | /*** alter arrow directions ***/
13 | .sf-vertical .sf-sub-indicator { background-position: -10px 0; } /* IE6 gets solid image only */
14 | .sf-vertical a > .sf-sub-indicator { background-position: 0 0; } /* use translucent arrow for modern browsers*/
15 |
16 | /* hover arrow direction for modern browsers*/
17 | .sf-vertical a:focus > .sf-sub-indicator,
18 | .sf-vertical a:hover > .sf-sub-indicator,
19 | .sf-vertical a:active > .sf-sub-indicator,
20 | .sf-vertical li:hover > a > .sf-sub-indicator,
21 | .sf-vertical li.sfHover > a > .sf-sub-indicator {
22 | background-position: -10px 0; /* arrow hovers for modern browsers*/
23 | }
--------------------------------------------------------------------------------
/www/views.py:
--------------------------------------------------------------------------------
1 | # python
2 | import os
3 | import datetime
4 | from pprint import pprint
5 |
6 | # djano
7 | from django.http import HttpResponse, HttpResponseRedirect, Http404
8 | from django.shortcuts import render_to_response, get_object_or_404
9 | from django.template import RequestContext
10 | from django.contrib.auth import REDIRECT_FIELD_NAME
11 | from django.contrib.auth.decorators import login_required, user_passes_test
12 |
13 | # project
14 | from models import ProjectCategory, Project, ProjectPhoto
15 |
16 |
17 | ################################################################################
18 | def _render(template, data, request):
19 | return render_to_response(template, data,
20 | context_instance=RequestContext(request))
21 |
22 |
23 | # Create your views here.
24 |
25 | def home_page(request):
26 | return _render('home.html', locals(), request)
27 |
28 | def projects_page(request):
29 | projects = Project.objects.all().order_by('add_date')
30 | return _render('projects.html', locals(), request)
--------------------------------------------------------------------------------
/urls.py:
--------------------------------------------------------------------------------
1 | from django.conf.urls.defaults import *
2 |
3 |
4 | import django.views.static
5 | from django.contrib import admin
6 | admin.autodiscover()
7 |
8 | # project
9 | from settings import MEDIA_ROOT
10 |
11 |
12 | urlpatterns = patterns('',
13 | # Example:
14 | (r'', include('www.urls')),
15 |
16 | # Uncomment the next line to enable admin documentation:
17 | (r'^admin/doc/', include('django.contrib.admindocs.urls')),
18 |
19 | # Uncomment the next line for to enable the admin:
20 | (r'^admin/(.*)', admin.site.root),
21 |
22 | # CSS, Javascript and IMages
23 | (r'^images/(?P.*)$', django.views.static.serve,
24 | {'document_root': MEDIA_ROOT + '/images',
25 | 'show_indexes': True}),
26 | (r'^css/(?P.*)$', django.views.static.serve,
27 | {'document_root': MEDIA_ROOT + '/css',
28 | 'show_indexes': True}),
29 | (r'^javascript/(?P.*)$', django.views.static.serve,
30 | {'document_root': MEDIA_ROOT + '/javascript',
31 | 'show_indexes': True}),
32 | )
33 |
--------------------------------------------------------------------------------
/www/context_processors.py:
--------------------------------------------------------------------------------
1 | # python
2 | import re
3 | from pprint import pprint
4 |
5 | # django
6 | from django.contrib.flatpages.models import FlatPage
7 |
8 | # project
9 | from arkitektm import settings
10 |
11 | def context(request):
12 | data = {'TEMPLATE_DEBUG': settings.TEMPLATE_DEBUG,
13 | 'DEBUG': settings.DEBUG,
14 | 'base_template': "base.html",
15 | 'mobile_version': False,
16 | 'mobile_user_agent': False,
17 | }
18 |
19 | #if settings.DEBUG:
20 | # data['ADMIN_MEDIA_PREFIX'] = '/'
21 | #else:
22 | # data['ADMIN_MEDIA_PREFIX'] = settings.ADMIN_MEDIA_PREFIX
23 |
24 | #if request.META.get('HTTP_USER_AGENT', None) and \
25 | # parseUserAgent(request.META.get('HTTP_USER_AGENT')):
26 | # data['mobile_user_agent'] = True
27 | # if not niceboolean(request.COOKIES.get('not_mobile', False)):
28 | # data['base_template'] = "mobile.html"
29 | # data['mobile_version'] = True
30 |
31 |
32 |
33 | return data
34 |
35 |
--------------------------------------------------------------------------------
/www/templates/projects.html:
--------------------------------------------------------------------------------
1 | {% extends base_template %}
2 | {% load thumbnail %}
3 | {% block extracss %}
4 |
5 |
9 | {% endblock %}
10 |
11 | {% block maincontent %}
12 |
13 |
14 | {% for project in projects %}
15 |
16 |
17 |
18 | {% for photo in project.get_photos %}
19 | {% thumbnail photo.photo 800x600 as big %}
20 | {% thumbnail photo.photo 120x120 as small %}
21 |
24 | {% endfor %}
25 |
26 |
27 |
28 |
{{ project.name }}
29 |
{{ project.show_description|safe }}
30 |
31 |
32 |
33 |
34 | {% endfor %}
35 |
36 |
37 | {% endblock %}
38 |
39 | {% block extrajs %}
40 |
41 |
47 | {% endblock %}
48 |
--------------------------------------------------------------------------------
/media/javascript/jquery.bgiframe.min.js:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2006 Brandon Aaron (http://brandonaaron.net)
2 | * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
3 | * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
4 | *
5 | * $LastChangedDate: 2007-06-19 20:25:28 -0500 (Tue, 19 Jun 2007) $
6 | * $Rev: 2111 $
7 | *
8 | * Version 2.1
9 | */
10 | (function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie&&parseInt($.browser.version)<=6){s=$.extend({top:'auto',left:'auto',width:'auto',height:'auto',opacity:true,src:'javascript:false;'},s||{});var prop=function(n){return n&&n.constructor==Number?n+'px':n;},html='';return this.each(function(){if($('> iframe.bgiframe',this).length==0)this.insertBefore(document.createElement(html),this.firstChild);});}return this;};if(!$.browser.version)$.browser.version=navigator.userAgent.toLowerCase().match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)[1];})(jQuery);
--------------------------------------------------------------------------------
/www/admin.py:
--------------------------------------------------------------------------------
1 | # django
2 | from django.contrib import admin
3 |
4 | # app
5 | from models import ProjectCategory, Project, ProjectPhoto
6 |
7 | class ProjectCategoryAdmin(admin.ModelAdmin):
8 | prepopulated_fields = {
9 | 'slug': ('name',),
10 | }
11 |
12 | ordering = ('name',)
13 | list_display = ('name', 'slug')
14 |
15 | def save_model(self, request, obj, form, change):
16 | if not request.user.is_superuser:
17 | obj.slug = get_slugify(obj.name, instance=obj)
18 | obj.save()
19 |
20 |
21 | admin.site.register(ProjectCategory, ProjectCategoryAdmin)
22 |
23 | class ProjectAdmin(admin.ModelAdmin):
24 | prepopulated_fields = {
25 | 'slug': ('name',),
26 | }
27 | ordering = ('name','current', 'add_date')
28 | list_filter = ['category','current']
29 | list_display = ('name', 'slug', 'category', 'current', 'add_date')
30 |
31 |
32 | def save_model(self, request, obj, form, change):
33 | if not request.user.is_superuser:
34 | obj.slug = get_slugify(obj.name, instance=obj)
35 | obj.save()
36 |
37 |
38 | admin.site.register(Project, ProjectAdmin)
39 |
40 | class ProjectPhotoAdmin(admin.ModelAdmin):
41 | ordering = ('title','add_date')
42 | list_display = ('title', 'project', 'add_date')
43 | list_filter = ['project']
44 |
45 | def save_model(self, request, obj, form, change):
46 | if obj.order == 1:
47 | other_orders = [x.order for x in ProjectPhoto.objects.filter(project=obj.project)]
48 | if other_orders:
49 | obj.order = max(other_orders) + 1
50 | else:
51 | obj.order = 1
52 | obj.save()
53 |
54 | admin.site.register(ProjectPhoto, ProjectPhotoAdmin)
55 |
--------------------------------------------------------------------------------
/media/css/superfish-navbar.css:
--------------------------------------------------------------------------------
1 |
2 | /*** adding the class sf-navbar in addition to sf-menu creates an all-horizontal nav-bar menu ***/
3 | .sf-navbar {
4 | background: #333333;
5 | height: 2.5em;
6 | padding-bottom: 2.5em;
7 | position: relative;
8 | }
9 | .sf-navbar li {
10 | background: #333333;
11 | position: static;
12 | }
13 | .sf-navbar a {
14 | border-top: none;
15 | }
16 | .sf-navbar li ul {
17 | width: 44em; /*IE6 soils itself without this*/
18 | }
19 | .sf-navbar li li {
20 | background: #333333;
21 | position: relative;
22 | }
23 | .sf-navbar li li ul {
24 | width: 13em;
25 | }
26 | .sf-navbar li li li {
27 | width: 100%;
28 | }
29 | .sf-navbar ul li {
30 | width: auto;
31 | float: left;
32 | }
33 | .sf-navbar a, .sf-navbar a:visited {
34 | border: none;
35 | }
36 | .sf-navbar li.current {
37 | background: #333333;
38 | }
39 | .sf-navbar li:hover,
40 | .sf-navbar li.sfHover,
41 | .sf-navbar li li.current,
42 | .sf-navbar a:focus, .sf-navbar a:hover, .sf-navbar a:active {
43 | background: #333333;
44 | }
45 | .sf-navbar ul li:hover,
46 | .sf-navbar ul li.sfHover,
47 | ul.sf-navbar ul li:hover li,
48 | ul.sf-navbar ul li.sfHover li,
49 | .sf-navbar ul a:focus, .sf-navbar ul a:hover, .sf-navbar ul a:active {
50 | background: #333333;
51 | }
52 | ul.sf-navbar li li li:hover,
53 | ul.sf-navbar li li li.sfHover,
54 | .sf-navbar li li.current li.current,
55 | .sf-navbar ul li li a:focus, .sf-navbar ul li li a:hover, .sf-navbar ul li li a:active {
56 | background: #333333;
57 | }
58 | ul.sf-navbar .current ul,
59 | ul.sf-navbar ul li:hover ul,
60 | ul.sf-navbar ul li.sfHover ul {
61 | left: 0;
62 | top: 2.5em; /* match top ul list item height */
63 | }
64 | ul.sf-navbar .current ul ul {
65 | top: -999em;
66 | }
67 |
68 | .sf-navbar li li.current > a {
69 | font-weight: bold;
70 | }
71 |
72 | /*** point all arrows down ***/
73 | /* point right for anchors in subs */
74 | .sf-navbar ul .sf-sub-indicator { background-position: -10px -100px; }
75 | .sf-navbar ul a > .sf-sub-indicator { background-position: 0 -100px; }
76 | /* apply hovers to modern browsers */
77 | .sf-navbar ul a:focus > .sf-sub-indicator,
78 | .sf-navbar ul a:hover > .sf-sub-indicator,
79 | .sf-navbar ul a:active > .sf-sub-indicator,
80 | .sf-navbar ul li:hover > a > .sf-sub-indicator,
81 | .sf-navbar ul li.sfHover > a > .sf-sub-indicator {
82 | background-position: -10px -100px; /* arrow hovers for modern browsers*/
83 | }
84 |
85 | /*** remove shadow on first submenu ***/
86 | .sf-navbar > li > ul {
87 | background: transparent;
88 | padding: 0;
89 | -moz-border-radius-bottomleft: 0;
90 | -moz-border-radius-topright: 0;
91 | -webkit-border-top-right-radius: 0;
92 | -webkit-border-bottom-left-radius: 0;
93 | }
--------------------------------------------------------------------------------
/media/css/jquery.lightbox-0.5.css:
--------------------------------------------------------------------------------
1 | /**
2 | * jQuery lightBox plugin
3 | * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
4 | * and adapted to me for use like a plugin from jQuery.
5 | * @name jquery-lightbox-0.5.css
6 | * @author Leandro Vieira Pinho - http://leandrovieira.com
7 | * @version 0.5
8 | * @date April 11, 2008
9 | * @category jQuery plugin
10 | * @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com)
11 | * @license CC Attribution-No Derivative Works 2.5 Brazil - http://creativecommons.org/licenses/by-nd/2.5/br/deed.en_US
12 | * @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin
13 | */
14 | #jquery-overlay {
15 | position: absolute;
16 | top: 0;
17 | left: 0;
18 | z-index: 90;
19 | width: 100%;
20 | height: 500px;
21 | }
22 | #jquery-lightbox {
23 | position: absolute;
24 | top: 0;
25 | left: 0;
26 | width: 100%;
27 | z-index: 100;
28 | text-align: center;
29 | line-height: 0;
30 | }
31 | #jquery-lightbox a img { border: none; }
32 | #lightbox-container-image-box {
33 | position: relative;
34 | background-color: #fff;
35 | width: 250px;
36 | height: 250px;
37 | margin: 0 auto;
38 | }
39 | #lightbox-container-image { padding: 10px; }
40 | #lightbox-loading {
41 | position: absolute;
42 | top: 40%;
43 | left: 0%;
44 | height: 25%;
45 | width: 100%;
46 | text-align: center;
47 | line-height: 0;
48 | }
49 | #lightbox-nav {
50 | position: absolute;
51 | top: 0;
52 | left: 0;
53 | height: 100%;
54 | width: 100%;
55 | z-index: 10;
56 | }
57 | #lightbox-container-image-box > #lightbox-nav { left: 0; }
58 | #lightbox-nav a { outline: none;}
59 | #lightbox-nav-btnPrev, #lightbox-nav-btnNext {
60 | width: 49%;
61 | height: 100%;
62 | zoom: 1;
63 | display: block;
64 | }
65 | #lightbox-nav-btnPrev {
66 | left: 0;
67 | float: left;
68 | }
69 | #lightbox-nav-btnNext {
70 | right: 0;
71 | float: right;
72 | }
73 | #lightbox-container-image-data-box {
74 | font: 10px Verdana, Helvetica, sans-serif;
75 | background-color: #fff;
76 | margin: 0 auto;
77 | line-height: 1.4em;
78 | overflow: auto;
79 | width: 100%;
80 | padding: 0 10px 0;
81 | }
82 | #lightbox-container-image-data {
83 | padding: 0 10px;
84 | color: #666;
85 | }
86 | #lightbox-container-image-data #lightbox-image-details {
87 | width: 70%;
88 | float: left;
89 | text-align: left;
90 | }
91 | #lightbox-image-details-caption { font-weight: bold; }
92 | #lightbox-image-details-currentNumber {
93 | display: block;
94 | clear: left;
95 | padding-bottom: 1.0em;
96 | }
97 | #lightbox-secNav-btnClose {
98 | width: 66px;
99 | float: right;
100 | padding-bottom: 0.7em;
101 | }
--------------------------------------------------------------------------------
/settings.py.default:
--------------------------------------------------------------------------------
1 | # Django settings for arkitektm project.
2 |
3 | DEBUG = True
4 | TEMPLATE_DEBUG = DEBUG
5 |
6 | ADMINS = (
7 | # ('Your Name', 'your_email@domain.com'),
8 | )
9 |
10 | MANAGERS = ADMINS
11 |
12 | DATABASE_ENGINE = '' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
13 | DATABASE_NAME = '' # Or path to database file if using sqlite3.
14 | DATABASE_USER = '' # Not used with sqlite3.
15 | DATABASE_PASSWORD = '' # Not used with sqlite3.
16 | DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
17 | DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
18 |
19 | # Local time zone for this installation. Choices can be found here:
20 | # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
21 | # although not all choices may be available on all operating systems.
22 | # If running in a Windows environment this must be set to the same as your
23 | # system time zone.
24 | TIME_ZONE = 'America/Chicago'
25 |
26 | # Language code for this installation. All choices can be found here:
27 | # http://www.i18nguy.com/unicode/language-identifiers.html
28 | LANGUAGE_CODE = 'en-us'
29 |
30 | SITE_ID = 1
31 |
32 | # If you set this to False, Django will make some optimizations so as not
33 | # to load the internationalization machinery.
34 | USE_I18N = True
35 |
36 | # Absolute path to the directory that holds media.
37 | # Example: "/home/media/media.lawrence.com/"
38 | MEDIA_ROOT = ''
39 |
40 | # URL that handles the media served from MEDIA_ROOT. Make sure to use a
41 | # trailing slash if there is a path component (optional in other cases).
42 | # Examples: "http://media.lawrence.com", "http://example.com/media/"
43 | MEDIA_URL = ''
44 |
45 | # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
46 | # trailing slash.
47 | # Examples: "http://foo.com/media/", "/media/".
48 | ADMIN_MEDIA_PREFIX = '/media/'
49 |
50 | # Make this unique, and don't share it with anybody.
51 | SECRET_KEY = '%0ah#8b#pd7v2okj_5)*m94845mexu@1i2*sg+dago@j$a1)1n'
52 |
53 | # List of callables that know how to import templates from various sources.
54 | TEMPLATE_LOADERS = (
55 | 'django.template.loaders.filesystem.load_template_source',
56 | 'django.template.loaders.app_directories.load_template_source',
57 | # 'django.template.loaders.eggs.load_template_source',
58 | )
59 |
60 | MIDDLEWARE_CLASSES = (
61 | 'django.middleware.common.CommonMiddleware',
62 | 'django.contrib.sessions.middleware.SessionMiddleware',
63 | 'django.contrib.auth.middleware.AuthenticationMiddleware',
64 | )
65 |
66 | ROOT_URLCONF = 'arkitektm.urls'
67 |
68 | TEMPLATE_DIRS = (
69 | # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
70 | # Always use forward slashes, even on Windows.
71 | # Don't forget to use absolute paths, not relative paths.
72 | )
73 |
74 | INSTALLED_APPS = (
75 | 'django.contrib.auth',
76 | 'django.contrib.contenttypes',
77 | 'django.contrib.sessions',
78 | 'django.contrib.sites',
79 | )
80 |
--------------------------------------------------------------------------------
/media/jquery-lightbox-0.5/index.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | jQuery lightBox plugin
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
21 |
41 |
42 |
43 |
44 |
45 | Example
46 | Click in the image and see the jQuery lightBox plugin in action.
47 |
76 |
77 |
78 |
--------------------------------------------------------------------------------
/media/javascript/hoverIntent.js:
--------------------------------------------------------------------------------
1 | (function($){
2 | /* hoverIntent by Brian Cherne */
3 | $.fn.hoverIntent = function(f,g) {
4 | // default configuration options
5 | var cfg = {
6 | sensitivity: 7,
7 | interval: 100,
8 | timeout: 0
9 | };
10 | // override configuration options with user supplied object
11 | cfg = $.extend(cfg, g ? { over: f, out: g } : f );
12 |
13 | // instantiate variables
14 | // cX, cY = current X and Y position of mouse, updated by mousemove event
15 | // pX, pY = previous X and Y position of mouse, set by mouseover and polling interval
16 | var cX, cY, pX, pY;
17 |
18 | // A private function for getting mouse position
19 | var track = function(ev) {
20 | cX = ev.pageX;
21 | cY = ev.pageY;
22 | };
23 |
24 | // A private function for comparing current and previous mouse position
25 | var compare = function(ev,ob) {
26 | ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
27 | // compare mouse positions to see if they've crossed the threshold
28 | if ( ( Math.abs(pX-cX) + Math.abs(pY-cY) ) < cfg.sensitivity ) {
29 | $(ob).unbind("mousemove",track);
30 | // set hoverIntent state to true (so mouseOut can be called)
31 | ob.hoverIntent_s = 1;
32 | return cfg.over.apply(ob,[ev]);
33 | } else {
34 | // set previous coordinates for next time
35 | pX = cX; pY = cY;
36 | // use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs)
37 | ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval );
38 | }
39 | };
40 |
41 | // A private function for delaying the mouseOut function
42 | var delay = function(ev,ob) {
43 | ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t);
44 | ob.hoverIntent_s = 0;
45 | return cfg.out.apply(ob,[ev]);
46 | };
47 |
48 | // A private function for handling mouse 'hovering'
49 | var handleHover = function(e) {
50 | // next three lines copied from jQuery.hover, ignore children onMouseOver/onMouseOut
51 | var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
52 | while ( p && p != this ) { try { p = p.parentNode; } catch(e) { p = this; } }
53 | if ( p == this ) { return false; }
54 |
55 | // copy objects to be passed into t (required for event object to be passed in IE)
56 | var ev = jQuery.extend({},e);
57 | var ob = this;
58 |
59 | // cancel hoverIntent timer if it exists
60 | if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); }
61 |
62 | // else e.type == "onmouseover"
63 | if (e.type == "mouseover") {
64 | // set "previous" X and Y position based on initial entry point
65 | pX = ev.pageX; pY = ev.pageY;
66 | // update "current" X and Y position based on mousemove
67 | $(ob).bind("mousemove",track);
68 | // start polling interval (self-calling timeout) to compare mouse coordinates over time
69 | if (ob.hoverIntent_s != 1) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );}
70 |
71 | // else e.type == "onmouseout"
72 | } else {
73 | // unbind expensive mousemove event
74 | $(ob).unbind("mousemove",track);
75 | // if hoverIntent state is true, then call the mouseOut function after the specified delay
76 | if (ob.hoverIntent_s == 1) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );}
77 | }
78 | };
79 |
80 | // bind the function to the two event listeners
81 | return this.mouseover(handleHover).mouseout(handleHover);
82 | };
83 |
84 | })(jQuery);
--------------------------------------------------------------------------------
/media/javascript/supersubs.js:
--------------------------------------------------------------------------------
1 |
2 | /*
3 | * Supersubs v0.2b - jQuery plugin
4 | * Copyright (c) 2008 Joel Birch
5 | *
6 | * Dual licensed under the MIT and GPL licenses:
7 | * http://www.opensource.org/licenses/mit-license.php
8 | * http://www.gnu.org/licenses/gpl.html
9 | *
10 | *
11 | * This plugin automatically adjusts submenu widths of suckerfish-style menus to that of
12 | * their longest list item children. If you use this, please expect bugs and report them
13 | * to the jQuery Google Group with the word 'Superfish' in the subject line.
14 | *
15 | */
16 |
17 | ;(function($){ // $ will refer to jQuery within this closure
18 |
19 | $.fn.supersubs = function(options){
20 | var opts = $.extend({}, $.fn.supersubs.defaults, options);
21 | // return original object to support chaining
22 | return this.each(function() {
23 | // cache selections
24 | var $$ = $(this);
25 | // support metadata
26 | var o = $.meta ? $.extend({}, opts, $$.data()) : opts;
27 | // get the font size of menu.
28 | // .css('fontSize') returns various results cross-browser, so measure an em dash instead
29 | var fontsize = $('').css({
30 | 'padding' : 0,
31 | 'position' : 'absolute',
32 | 'top' : '-999em',
33 | 'width' : 'auto'
34 | }).appendTo($$).width(); //clientWidth is faster, but was incorrect here
35 | // remove em dash
36 | $('#menu-fontsize').remove();
37 | // cache all ul elements
38 | $ULs = $$.find('ul');
39 | // loop through each ul in menu
40 | $ULs.each(function(i) {
41 | // cache this ul
42 | var $ul = $ULs.eq(i);
43 | // get all (li) children of this ul
44 | var $LIs = $ul.children();
45 | // get all anchor grand-children
46 | var $As = $LIs.children('a');
47 | // force content to one line and save current float property
48 | var liFloat = $LIs.css('white-space','nowrap').css('float');
49 | // remove width restrictions and floats so elements remain vertically stacked
50 | var emWidth = $ul.add($LIs).add($As).css({
51 | 'float' : 'none',
52 | 'width' : 'auto'
53 | })
54 | // this ul will now be shrink-wrapped to longest li due to position:absolute
55 | // so save its width as ems. Clientwidth is 2 times faster than .width() - thanks Dan Switzer
56 | .end().end()[0].clientWidth / fontsize;
57 | // add more width to ensure lines don't turn over at certain sizes in various browsers
58 | emWidth += o.extraWidth;
59 | // restrict to at least minWidth and at most maxWidth
60 | if (emWidth > o.maxWidth) { emWidth = o.maxWidth; }
61 | else if (emWidth < o.minWidth) { emWidth = o.minWidth; }
62 | emWidth += 'em';
63 | // set ul to width in ems
64 | $ul.css('width',emWidth);
65 | // restore li floats to avoid IE bugs
66 | // set li width to full width of this ul
67 | // revert white-space to normal
68 | $LIs.css({
69 | 'float' : liFloat,
70 | 'width' : '100%',
71 | 'white-space' : 'normal'
72 | })
73 | // update offset position of descendant ul to reflect new width of parent
74 | .each(function(){
75 | var $childUl = $('>ul',this);
76 | var offsetDirection = $childUl.css('left')!==undefined ? 'left' : 'right';
77 | $childUl.css(offsetDirection,emWidth);
78 | });
79 | });
80 |
81 | });
82 | };
83 | // expose defaults
84 | $.fn.supersubs.defaults = {
85 | minWidth : 9, // requires em unit.
86 | maxWidth : 25, // requires em unit.
87 | extraWidth : 0 // extra width can ensure lines don't sometimes turn over due to slight browser differences in how they round-off values
88 | };
89 |
90 | })(jQuery); // plugin code ends
91 |
--------------------------------------------------------------------------------
/www/templatetags/menu_extras.py:
--------------------------------------------------------------------------------
1 | # python
2 | import re
3 | from cgi import escape
4 | from pprint import pprint
5 |
6 | # django
7 | from django.contrib.flatpages.models import FlatPage
8 | from django import template
9 |
10 | # app
11 | from settings import DEBUG
12 |
13 |
14 | register = template.Library()
15 |
16 | @register.filter()
17 | def clean_numbered_title(title):
18 | return _clean_numbered_title(title)
19 |
20 | numbered_title_regex = re.compile('^\d+\.?\s*')
21 | def _clean_numbered_title(title):
22 | return numbered_title_regex.sub('', title).strip()
23 |
24 |
25 | class FlatpageToMenuNode(template.Node):
26 | def __init__(self, css_class=None):
27 | self.css_class = css_class
28 | def render(self, context):
29 | return flatpages_to_menu(css_class=self.css_class)
30 |
31 | @register.tag(name='flatpages_to_menu')
32 | def flatpages_to_menu_node(parser, token):
33 | _split = token.split_contents()
34 | tag_name = _split[0]
35 | options = _split[1:]
36 | css_class = None
37 | try:
38 | css_class = options[0]
39 | if not (css_class[0] == css_class[-1] and css_class[0] in ('"', "'")):
40 | raise template.TemplateSyntaxError, "%r tag's argument should be in quotes" % tag_name
41 | css_class = css_class[1:-1]
42 | except IndexError:
43 | pass
44 |
45 | return FlatpageToMenuNode(css_class=css_class)
46 |
47 |
48 |
49 | def flatpages_to_menu(css_class=None):
50 | html = []
51 | recursive_list = _flatpages()
52 | if DEBUG:
53 | #pprint(recursive_list)
54 | html = '\n'.join(_flatpages_html(recursive_list))
55 | else:
56 | html = ''.join(_flatpages_html(recursive_list))
57 | if css_class:
58 | html = html.replace('','' % css_class, 1)
59 | return html
60 |
61 | def _flatpages_html(sub_pages):
62 | pages = ['']
63 | for each in sub_pages:
64 | pages.append('%s ' % (each['url'], escape(each['title'])))
65 |
66 | if each.get('children'):
67 | pages.extend(_flatpages_html(each.get('children')))
68 | pages.append(' ')
69 |
70 | pages.append(' ')
71 | return pages
72 |
73 | anchors_regex = re.compile('[\w_]+)">(?P.*?) ')
74 |
75 | def _flatpages(inside='', depth=1):
76 | pages = []
77 |
78 | if inside:
79 | qs = FlatPage.objects.filter(url__startswith=inside)
80 | else:
81 | qs = FlatPage.objects.all()
82 |
83 |
84 | qs = qs.order_by('title')
85 | for flatpage in qs:
86 | this_url = flatpage.url#.replace(inside, '')
87 | this_depth = len([x for x in this_url.split('/') if x.strip()])
88 |
89 | # the OR part is for any flat page with url='/'
90 | if this_depth == depth or (this_depth == 0 and depth == 1):
91 | url = flatpage.url
92 | page = dict(url=flatpage.url,
93 | title=_clean_numbered_title(flatpage.title))
94 | sub_pages = []
95 | if depth >= 1 and this_depth != 0:
96 | sub_pages = _flatpages(inside=this_url, depth=depth+1)
97 |
98 | if not sub_pages:
99 | for anchor in anchors_regex.findall(flatpage.content):
100 | #print anchor
101 | #print dir(anchor), type(anchor)
102 | sub_pages.append(dict(url=flatpage.url+'#'+anchor[0],
103 | title=anchor[1]))
104 |
105 | if sub_pages:
106 | page['children'] = sub_pages
107 | pages.append(page)
108 |
109 |
110 | return pages
111 |
--------------------------------------------------------------------------------
/www/templates/base.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {% block title %}Arkitekt och Miljö AB - Arkitektkontoret som bryr sig om dig.{% endblock %}
5 |
6 |
7 |
8 |
9 | {% block extracss %}{% endblock %}
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | {% load menu_extras %}
26 | {% flatpages_to_menu "sf-menu" %}
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 | {% block maincontent %}
37 | tomt :(
38 | {% endblock %}
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 | Arkitekt & Miljö AB
50 | Stortorget 34
51 | 392 31 Kalmar
52 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
84 | {% block extrajs %}{% endblock %}
85 |
86 |
87 |
--------------------------------------------------------------------------------
/settings.py:
--------------------------------------------------------------------------------
1 | # Django settings for arkitektm project.
2 |
3 | DEBUG = True
4 | TEMPLATE_DEBUG = DEBUG
5 |
6 | HOME = '/home/peterbe/dev/DJANGO/arkitektm_env/arkitektm'
7 |
8 | #TEST_RUNNER = 'arkitektm.testrunner.run_tests'
9 |
10 | ADMINS = (
11 | # ('Your Name', 'your_email@domain.com'),
12 | )
13 |
14 | MANAGERS = ADMINS
15 |
16 | DATABASE_ENGINE = 'postgresql_psycopg2' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
17 | DATABASE_NAME = 'arkitektm' # Or path to database file if using sqlite3.
18 | DATABASE_USER = '' # Not used with sqlite3.
19 | DATABASE_PASSWORD = '' # Not used with sqlite3.
20 | DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
21 | DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
22 |
23 | # Local time zone for this installation. Choices can be found here:
24 | # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
25 | # although not all choices may be available on all operating systems.
26 | # If running in a Windows environment this must be set to the same as your
27 | # system time zone.
28 | TIME_ZONE = 'Europe/London'
29 |
30 | # Language code for this installation. All choices can be found here:
31 | # http://www.i18nguy.com/unicode/language-identifiers.html
32 | LANGUAGE_CODE = 'sv-SE'
33 |
34 | SITE_ID = 1
35 |
36 | # If you set this to False, Django will make some optimizations so as not
37 | # to load the internationalization machinery.
38 | USE_I18N = True
39 |
40 | # Absolute path to the directory that holds media.
41 | # Example: "/home/media/media.lawrence.com/"
42 | MEDIA_ROOT = HOME + '/media'
43 |
44 | # URL that handles the media served from MEDIA_ROOT. Make sure to use a
45 | # trailing slash if there is a path component (optional in other cases).
46 | # Examples: "http://media.lawrence.com", "http://example.com/media/"
47 | MEDIA_URL = ''
48 |
49 | # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
50 | # trailing slash.
51 | # Examples: "http://foo.com/media/", "/media/".
52 | ADMIN_MEDIA_PREFIX = '/media/admin/'
53 |
54 |
55 | # List of callables that know how to import templates from various sources.
56 | TEMPLATE_LOADERS = (
57 | 'django.template.loaders.filesystem.load_template_source',
58 | 'django.template.loaders.app_directories.load_template_source',
59 | # 'django.template.loaders.eggs.load_template_source',
60 | )
61 |
62 | MIDDLEWARE_CLASSES = (
63 | 'django.middleware.common.CommonMiddleware',
64 | 'django.contrib.sessions.middleware.SessionMiddleware',
65 | 'django.contrib.auth.middleware.AuthenticationMiddleware',
66 | 'django.middleware.doc.XViewMiddleware',
67 | 'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
68 |
69 | )
70 |
71 | ROOT_URLCONF = 'arkitektm.urls'
72 |
73 | TEMPLATE_DIRS = (
74 | # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
75 | # Always use forward slashes, even on Windows.
76 | # Don't forget to use absolute paths, not relative paths.
77 | HOME + '/templates',
78 | HOME + '/arkitektm/templates',
79 |
80 | )
81 |
82 | INSTALLED_APPS = (
83 | 'django.contrib.auth',
84 | 'django.contrib.contenttypes',
85 | 'django.contrib.sessions',
86 | 'django.contrib.sites',
87 | 'django.contrib.admin',
88 | 'www',
89 | 'django.contrib.flatpages',
90 | 'sorl.thumbnail',
91 | )
92 |
93 | TEMPLATE_CONTEXT_PROCESSORS = (
94 | 'django.core.context_processors.auth',
95 | 'django.core.context_processors.debug',
96 | 'django.core.context_processors.i18n',
97 | 'django.core.context_processors.media',
98 | 'arkitektm.www.context_processors.context',
99 | )
100 |
101 | TEMPLATE_STRING_IF_INVALID = ''
102 |
103 | try:
104 | from settings_local import *
105 | except ImportError:
106 | pass
107 |
108 | try:
109 | HOME, SECRET_KEY
110 | except NameError:
111 | print "Certain variables must be defined in settings_local.py"
112 | raise
--------------------------------------------------------------------------------
/media/css/superfish.css:
--------------------------------------------------------------------------------
1 | /*** ESSENTIAL STYLES ***/
2 | .sf-menu, .sf-menu * {
3 | margin: 0;
4 | padding: 0;
5 | list-style: none;
6 | }
7 | .sf-menu {
8 | line-height: 1;
9 | font-family: Verdana, Arial, Helvetica, sans-serif;
10 | font-size: 12px;
11 | color: #333333;
12 | font-weight: bold;
13 | }
14 | .sf-menu ul {
15 | position: absolute;
16 | top: -999em;
17 | width: 10em; /* left offset of submenus need to match (see below) */
18 | }
19 | .sf-menu ul li {
20 | width: 100%;
21 | }
22 | .sf-menu li:hover {
23 | visibility: inherit; /* fixes IE7 'sticky bug' */
24 | }
25 | .sf-menu li {
26 | float: left;
27 | position: relative;
28 | }
29 | .sf-menu a {
30 | display: block;
31 | position: relative;
32 | }
33 | .sf-menu li:hover ul,
34 | .sf-menu li.sfHover ul {
35 | left: 0;
36 | top: 2.5em; /* match top ul list item height */
37 | z-index: 99;
38 | }
39 | ul.sf-menu li:hover li ul,
40 | ul.sf-menu li.sfHover li ul {
41 | top: -999em;
42 | }
43 | ul.sf-menu li li:hover ul,
44 | ul.sf-menu li li.sfHover ul {
45 | left: 10em; /* match ul width */
46 | top: 0;
47 | }
48 | ul.sf-menu li li:hover li ul,
49 | ul.sf-menu li li.sfHover li ul {
50 | top: -999em;
51 | }
52 | ul.sf-menu li li li:hover ul,
53 | ul.sf-menu li li li.sfHover ul {
54 | left: 10em; /* match ul width */
55 | top: 0;
56 | }
57 |
58 | /*** DEMO SKIN ***/
59 | .sf-menu {
60 | float: left;
61 | margin-bottom: 1em;
62 | }
63 | .sf-menu a {
64 | padding: .75em 1em;
65 | text-decoration:none;
66 | border-top-width: 1px;
67 | border-left-width: 1px;
68 | border-top-style: none;
69 | border-left-style: none;
70 | border-top-color: #CFDEFF;
71 | border-left-color: #FFFFFF;
72 | }
73 | .sf-menu a, .sf-menu a:visited { /* visited pseudo selector so IE6 applies text colour*/
74 | color: #FFFFFF;
75 | }
76 | .sf-menu li {
77 | background: #CCCCCC;
78 | }
79 | .sf-menu li li {
80 | background: #AAAAAA;
81 | }
82 | .sf-menu li li li {
83 | background: #CCCCCC;
84 | }
85 | .sf-menu li:hover, .sf-menu li.sfHover,
86 | .sf-menu a:focus, .sf-menu a:hover, .sf-menu a:active {
87 | outline: 0;
88 | background-color: #666666;
89 | }
90 |
91 | /*** arrows **/
92 | .sf-menu a.sf-with-ul {
93 | padding-right: 2.25em;
94 | min-width: 1px; /* trigger IE7 hasLayout so spans position accurately */
95 | }
96 | .sf-sub-indicator {
97 | position: absolute;
98 | display: block;
99 | right: .75em;
100 | top: 1.05em; /* IE6 only */
101 | width: 10px;
102 | height: 10px;
103 | text-indent: -999em;
104 | overflow: hidden;
105 | background: url('../images/arrows-ffffff.png') no-repeat -10px -100px; /* 8-bit indexed alpha png. IE6 gets solid image only */
106 | }
107 | a > .sf-sub-indicator { /* give all except IE6 the correct values */
108 | top: .8em;
109 | background-position: 0 -100px; /* use translucent arrow for modern browsers*/
110 | }
111 | /* apply hovers to modern browsers */
112 | a:focus > .sf-sub-indicator,
113 | a:hover > .sf-sub-indicator,
114 | a:active > .sf-sub-indicator,
115 | li:hover > a > .sf-sub-indicator,
116 | li.sfHover > a > .sf-sub-indicator {
117 | background-position: -10px -100px; /* arrow hovers for modern browsers*/
118 | }
119 |
120 | /* point right for anchors in subs */
121 | .sf-menu ul .sf-sub-indicator { background-position: -10px 0; }
122 | .sf-menu ul a > .sf-sub-indicator { background-position: 0 0; }
123 | /* apply hovers to modern browsers */
124 | .sf-menu ul a:focus > .sf-sub-indicator,
125 | .sf-menu ul a:hover > .sf-sub-indicator,
126 | .sf-menu ul a:active > .sf-sub-indicator,
127 | .sf-menu ul li:hover > a > .sf-sub-indicator,
128 | .sf-menu ul li.sfHover > a > .sf-sub-indicator {
129 | background-position: -10px 0; /* arrow hovers for modern browsers*/
130 | }
131 |
132 | /*** shadows for all but IE6 ***/
133 | .sf-shadow ul {
134 | background: url('../images/shadow.png') no-repeat bottom right;
135 | padding: 0 8px 9px 0;
136 | -moz-border-radius-bottomleft: 17px;
137 | -moz-border-radius-topright: 17px;
138 | -webkit-border-top-right-radius: 17px;
139 | -webkit-border-bottom-left-radius: 17px;
140 | }
141 | .sf-shadow ul.sf-shadow-off {
142 | background: transparent;
143 | }
144 |
--------------------------------------------------------------------------------
/media/javascript/superfish.js:
--------------------------------------------------------------------------------
1 |
2 | /*
3 | * Superfish v1.4.8 - jQuery menu widget
4 | * Copyright (c) 2008 Joel Birch
5 | *
6 | * Dual licensed under the MIT and GPL licenses:
7 | * http://www.opensource.org/licenses/mit-license.php
8 | * http://www.gnu.org/licenses/gpl.html
9 | *
10 | * CHANGELOG: http://users.tpg.com.au/j_birch/plugins/superfish/changelog.txt
11 | */
12 |
13 | ;(function($){
14 | $.fn.superfish = function(op){
15 |
16 | var sf = $.fn.superfish,
17 | c = sf.c,
18 | $arrow = $([' » '].join('')),
19 | over = function(){
20 | var $$ = $(this), menu = getMenu($$);
21 | clearTimeout(menu.sfTimer);
22 | $$.showSuperfishUl().siblings().hideSuperfishUl();
23 | },
24 | out = function(){
25 | var $$ = $(this), menu = getMenu($$), o = sf.op;
26 | clearTimeout(menu.sfTimer);
27 | menu.sfTimer=setTimeout(function(){
28 | o.retainPath=($.inArray($$[0],o.$path)>-1);
29 | $$.hideSuperfishUl();
30 | if (o.$path.length && $$.parents(['li.',o.hoverClass].join('')).length<1){over.call(o.$path);}
31 | },o.delay);
32 | },
33 | getMenu = function($menu){
34 | var menu = $menu.parents(['ul.',c.menuClass,':first'].join(''))[0];
35 | sf.op = sf.o[menu.serial];
36 | return menu;
37 | },
38 | addArrow = function($a){ $a.addClass(c.anchorClass).append($arrow.clone()); };
39 |
40 | return this.each(function() {
41 | var s = this.serial = sf.o.length;
42 | var o = $.extend({},sf.defaults,op);
43 | o.$path = $('li.'+o.pathClass,this).slice(0,o.pathLevels).each(function(){
44 | $(this).addClass([o.hoverClass,c.bcClass].join(' '))
45 | .filter('li:has(ul)').removeClass(o.pathClass);
46 | });
47 | sf.o[s] = sf.op = o;
48 |
49 | $('li:has(ul)',this)[($.fn.hoverIntent && !o.disableHI) ? 'hoverIntent' : 'hover'](over,out).each(function() {
50 | if (o.autoArrows) addArrow( $('>a:first-child',this) );
51 | })
52 | .not('.'+c.bcClass)
53 | .hideSuperfishUl();
54 |
55 | var $a = $('a',this);
56 | $a.each(function(i){
57 | var $li = $a.eq(i).parents('li');
58 | $a.eq(i).focus(function(){over.call($li);}).blur(function(){out.call($li);});
59 | });
60 | o.onInit.call(this);
61 |
62 | }).each(function() {
63 | menuClasses = [c.menuClass];
64 | if (sf.op.dropShadows && !($.browser.msie && $.browser.version < 7)) menuClasses.push(c.shadowClass);
65 | $(this).addClass(menuClasses.join(' '));
66 | });
67 | };
68 |
69 | var sf = $.fn.superfish;
70 | sf.o = [];
71 | sf.op = {};
72 | sf.IE7fix = function(){
73 | var o = sf.op;
74 | if ($.browser.msie && $.browser.version > 6 && o.dropShadows && o.animation.opacity!=undefined)
75 | this.toggleClass(sf.c.shadowClass+'-off');
76 | };
77 | sf.c = {
78 | bcClass : 'sf-breadcrumb',
79 | menuClass : 'sf-js-enabled',
80 | anchorClass : 'sf-with-ul',
81 | arrowClass : 'sf-sub-indicator',
82 | shadowClass : 'sf-shadow'
83 | };
84 | sf.defaults = {
85 | hoverClass : 'sfHover',
86 | pathClass : 'overideThisToUse',
87 | pathLevels : 1,
88 | delay : 400,
89 | animation : {opacity:'show'},
90 | speed : 'fast',
91 | autoArrows : true,
92 | dropShadows : true,
93 | disableHI : false, // true disables hoverIntent detection
94 | onInit : function(){}, // callback functions
95 | onBeforeShow: function(){},
96 | onShow : function(){},
97 | onHide : function(){}
98 | };
99 | $.fn.extend({
100 | hideSuperfishUl : function(){
101 | var o = sf.op,
102 | not = (o.retainPath===true) ? o.$path : '';
103 | o.retainPath = false;
104 | var $ul = $(['li.',o.hoverClass].join(''),this).add(this).not(not).removeClass(o.hoverClass)
105 | .find('>ul').hide().css('visibility','hidden');
106 | o.onHide.call($ul);
107 | return this;
108 | },
109 | showSuperfishUl : function(){
110 | var o = sf.op,
111 | sh = sf.c.shadowClass+'-off',
112 | $ul = this.addClass(o.hoverClass)
113 | .find('>ul:hidden').css('visibility','visible');
114 | sf.IE7fix.call($ul);
115 | o.onBeforeShow.call($ul);
116 | $ul.animate(o.animation,o.speed,function(){ sf.IE7fix.call($ul); o.onShow.call($ul); });
117 | return this;
118 | }
119 | });
120 |
121 | })(jQuery);
122 |
--------------------------------------------------------------------------------
/media/javascript/jquery.lightbox-0.5.pack.js:
--------------------------------------------------------------------------------
1 | /**
2 | * jQuery lightBox plugin
3 | * This jQuery plugin was inspired and based on Lightbox 2 by Lokesh Dhakar (http://www.huddletogether.com/projects/lightbox2/)
4 | * and adapted to me for use like a plugin from jQuery.
5 | * @name jquery-lightbox-0.5.js
6 | * @author Leandro Vieira Pinho - http://leandrovieira.com
7 | * @version 0.5
8 | * @date April 11, 2008
9 | * @category jQuery plugin
10 | * @copyright (c) 2008 Leandro Vieira Pinho (leandrovieira.com)
11 | * @license CC Attribution-No Derivative Works 2.5 Brazil - http://creativecommons.org/licenses/by-nd/2.5/br/deed.en_US
12 | * @example Visit http://leandrovieira.com/projects/jquery/lightbox/ for more informations about this jQuery plugin
13 | */
14 | eval(function(p,a,c,k,e,r){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(6($){$.2N.3g=6(4){4=23.2H({2B:\'#34\',2g:0.8,1d:F,1M:\'18/5-33-Y.16\',1v:\'18/5-1u-2Q.16\',1E:\'18/5-1u-2L.16\',1W:\'18/5-1u-2I.16\',19:\'18/5-2F.16\',1f:10,2A:3d,2s:\'1j\',2o:\'32\',2j:\'c\',2f:\'p\',2d:\'n\',h:[],9:0},4);f I=N;6 20(){1X(N,I);u F}6 1X(1e,I){$(\'1U, 1S, 1R\').l({\'1Q\':\'2E\'});1O();4.h.B=0;4.9=0;7(I.B==1){4.h.1J(v 1m(1e.17(\'J\'),1e.17(\'2v\')))}j{36(f i=0;i<1w g="5-b"><1w W="\'+4.1M+\'"> <1i g="5-b-A-1t">1i><1i g="5-b-A-1g">1i> <1w W="\'+4.1W+\'"> \');f z=1D();$(\'#q-13\').l({2K:4.2B,2J:4.2g,S:z[0],P:z[1]}).1V();f R=1p();$(\'#q-5\').l({1T:R[1]+(z[3]/10),1c:R[0]}).E();$(\'#q-13,#q-5\').C(6(){1a()});$(\'#5-Y-29,#5-1s-22\').C(6(){1a();u F});$(G).2G(6(){f z=1D();$(\'#q-13\').l({S:z[0],P:z[1]});f R=1p();$(\'#q-5\').l({1T:R[1]+(z[3]/10),1c:R[0]})})}6 D(){$(\'#5-Y\').E();7(4.1d){$(\'#5-b,#5-s-b-T-w,#5-b-A-1g\').1b()}j{$(\'#5-b,#5-k,#5-k-V,#5-k-X,#5-s-b-T-w,#5-b-A-1g\').1b()}f Q=v 1j();Q.1P=6(){$(\'#5-b\').2D(\'W\',4.h[4.9][0]);1N(Q.S,Q.P);Q.1P=6(){}};Q.W=4.h[4.9][0]};6 1N(1o,1r){f 1L=$(\'#5-s-b-w\').S();f 1K=$(\'#5-s-b-w\').P();f 1n=(1o+(4.1f*2));f 1y=(1r+(4.1f*2));f 1I=1L-1n;f 2z=1K-1y;$(\'#5-s-b-w\').3f({S:1n,P:1y},4.2A,6(){2y()});7((1I==0)&&(2z==0)){7($.3e.3c){1H(3b)}j{1H(3a)}}$(\'#5-s-b-T-w\').l({S:1o});$(\'#5-k-V,#5-k-X\').l({P:1r+(4.1f*2)})};6 2y(){$(\'#5-Y\').1b();$(\'#5-b\').1V(6(){2u();2t()});2r()};6 2u(){$(\'#5-s-b-T-w\').38(\'35\');$(\'#5-b-A-1t\').1b();7(4.h[4.9][1]){$(\'#5-b-A-1t\').2p(4.h[4.9][1]).E()}7(4.h.B>1){$(\'#5-b-A-1g\').2p(4.2s+\' \'+(4.9+1)+\' \'+4.2o+\' \'+4.h.B).E()}}6 2t(){$(\'#5-k\').E();$(\'#5-k-V,#5-k-X\').l({\'K\':\'1C M(\'+4.19+\') L-O\'});7(4.9!=0){7(4.1d){$(\'#5-k-V\').l({\'K\':\'M(\'+4.1v+\') 1c 15% L-O\'}).11().1k(\'C\',6(){4.9=4.9-1;D();u F})}j{$(\'#5-k-V\').11().2m(6(){$(N).l({\'K\':\'M(\'+4.1v+\') 1c 15% L-O\'})},6(){$(N).l({\'K\':\'1C M(\'+4.19+\') L-O\'})}).E().1k(\'C\',6(){4.9=4.9-1;D();u F})}}7(4.9!=(4.h.B-1)){7(4.1d){$(\'#5-k-X\').l({\'K\':\'M(\'+4.1E+\') 2l 15% L-O\'}).11().1k(\'C\',6(){4.9=4.9+1;D();u F})}j{$(\'#5-k-X\').11().2m(6(){$(N).l({\'K\':\'M(\'+4.1E+\') 2l 15% L-O\'})},6(){$(N).l({\'K\':\'1C M(\'+4.19+\') L-O\'})}).E().1k(\'C\',6(){4.9=4.9+1;D();u F})}}2k()}6 2k(){$(d).30(6(12){2i(12)})}6 1G(){$(d).11()}6 2i(12){7(12==2h){U=2Z.2e;1x=27}j{U=12.2e;1x=12.2Y}14=2X.2W(U).2U();7((14==4.2j)||(14==\'x\')||(U==1x)){1a()}7((14==4.2f)||(U==37)){7(4.9!=0){4.9=4.9-1;D();1G()}}7((14==4.2d)||(U==39)){7(4.9!=(4.h.B-1)){4.9=4.9+1;D();1G()}}}6 2r(){7((4.h.B-1)>4.9){2c=v 1j();2c.W=4.h[4.9+1][0]}7(4.9>0){2b=v 1j();2b.W=4.h[4.9-1][0]}}6 1a(){$(\'#q-5\').2a();$(\'#q-13\').2T(6(){$(\'#q-13\').2a()});$(\'1U, 1S, 1R\').l({\'1Q\':\'2S\'})}6 1D(){f o,r;7(G.1h&&G.28){o=G.26+G.2R;r=G.1h+G.28}j 7(d.m.25>d.m.24){o=d.m.2P;r=d.m.25}j{o=d.m.2O;r=d.m.24}f y,H;7(Z.1h){7(d.t.1l){y=d.t.1l}j{y=Z.26}H=Z.1h}j 7(d.t&&d.t.1A){y=d.t.1l;H=d.t.1A}j 7(d.m){y=d.m.1l;H=d.m.1A}7(r \n')
19 |
20 | ################################################################################
21 |
22 | class ProjectCategory(models.Model):
23 | """
24 | A category for the projects. Very simple:
25 |
26 | >>> c = ProjectCategory.objects.create(name=u'Apa')
27 | >>> c.name
28 | u'Apa'
29 | """
30 | name = models.CharField(max_length=100)
31 | slug = models.SlugField('Slug', blank=True)
32 |
33 | class Meta:
34 | verbose_name_plural = u'Kategorier'
35 | verbose_name = u'Kategori'
36 | db_table = u'project_categories'
37 |
38 | def __init__(self, *args, **kwargs):
39 | if 'name' in kwargs and 'slug' not in kwargs:
40 | kwargs['slug'] = slugify(kwargs['name'])
41 | super(ProjectCategory, self).__init__(*args, **kwargs)
42 |
43 | def __unicode__(self):
44 | return self.name
45 |
46 |
47 | class Project(models.Model):
48 | """
49 | A project holds information and photos. Basically a project
50 | is a name, description, date, current and category. Simple test:
51 |
52 | >>> p = Project.objects.create(name=u'G\xf6tt')
53 | >>> p.current
54 | True
55 | >>> p.get_absolute_url()
56 | u'/projekt/Gott/'
57 | >>> import datetime
58 | >>> today = datetime.datetime.now()
59 | >>> p.add_date.year == today.year
60 | True
61 | >>> p.add_date.month == today.month
62 | True
63 | >>> p.add_date.day == today.day
64 | True
65 | >>> p.description
66 | u''
67 |
68 | If you first add a category you can set that on a project:
69 |
70 | >>> c = ProjectCategory.objects.create(name=u'Ost')
71 | >>> p = Project.objects.create(name=u'France', category=c)
72 | >>> p.category.name
73 | u'Ost'
74 |
75 | If the description contains newlines and HTML you can use show_description():
76 |
77 | >>> p.description = u'