Lots of stuff

- Imagestore gallery
- remember me fixed
- youtube filter
- password change option
This commit is contained in:
Martin Bauer
2013-10-03 11:27:06 +02:00
parent 0e26988867
commit 114a2df9cf
179 changed files with 4987 additions and 159 deletions

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 97 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

44
blechreiz/middleware.py Normal file
View File

@@ -0,0 +1,44 @@
from django.http import HttpResponseRedirect
from django.conf import settings
import re
class EnforceLoginMiddleware(object):
"""
Middlware class which requires the user to be authenticated for all urls except
those defined in PUBLIC_URLS in settings.py. PUBLIC_URLS should be a tuple of regular
expresssions for the urls you want anonymous users to have access to. If PUBLIC_URLS
is not defined, it falls back to LOGIN_URL or failing that '/accounts/login/'.
Requests for urls not matching PUBLIC_URLS get redirected to LOGIN_URL with next set
to original path of the unauthenticted request.
Any urls statically served by django are excluded from this check. To enforce the same
validation on these set SERVE_STATIC_TO_PUBLIC to False.
"""
def __init__(self):
self.login_url = getattr(settings, 'LOGIN_URL', '/accounts/login/' )
if hasattr(settings,'PUBLIC_URLS'):
public_urls = [re.compile(url) for url in settings.PUBLIC_URLS]
else:
public_urls = [(re.compile("^%s/?$" % ( self.login_url[1:] )))]
if getattr(settings, 'SERVE_STATIC_TO_PUBLIC', True ):
root_urlconf = __import__(settings.ROOT_URLCONF)
public_urls.extend([ re.compile(url.regex)
for url in root_urlconf.urls.urlpatterns
if url.__dict__.get('_callback_str') == 'django.views.static.serve'
])
self.public_urls = tuple(public_urls)
def process_request(self, request):
"""
Redirect anonymous users to login_url from non public urls
"""
try:
if request.user.is_anonymous():
for url in self.public_urls:
if url.match(request.path[1:]):
return None
return HttpResponseRedirect("%s?next=%s" % (self.login_url, request.path))
except AttributeError:
return HttpResponseRedirect("%s?next=%s" % (self.login_url, request.path))

View File

@@ -70,6 +70,9 @@ STATIC_ROOT = '/'
# Example: "http://example.com/static/", "http://static.example.com/"
STATIC_URL = '/static/'
LOGIN_URL="/login"
PUBLIC_URLS=( "^login/?$", "^login/usernames/?$")
# Additional locations of static files
STATICFILES_DIRS = (
PROJECT_PATH + '/static',
@@ -84,7 +87,7 @@ STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
)
# Make this unique, and don't share it with anybody.
SECRET_KEY = 'x$8&9s6t%eeg=wyhar87934wh_s$dbpm(73g4ho&n)9_wogj6p'
@@ -102,6 +105,7 @@ MIDDLEWARE_CLASSES = (
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'blechreiz.middleware.EnforceLoginMiddleware'
# Uncomment the next line for simple clickjacking protection:
# 'django.middleware.clickjacking.XFrameOptionsMiddleware',
)
@@ -146,9 +150,14 @@ INSTALLED_APPS = (
'eventplanner', # Event Management
'simpleforum', # Messages ( Forum )
'location_field', # custom location field used in Event Management
'imagestore',
'sorl.thumbnail',
'tagging'
)
LOGIN_URL="/login"
IMAGESTORE_TEMPLATE = "website/base.html"
REST_FRAMEWORK = {

View File

@@ -2,11 +2,12 @@ from django.conf.urls import patterns, include, url
from django.contrib import admin
import website.views
import simpleforum.views
import eventplanner.urls
import musicians.urls
import imagestore.urls
import website.urls
import settings
@@ -15,13 +16,11 @@ from django.conf.urls.static import static
admin.autodiscover()
urlpatterns = patterns('',
url(r'$^', website.views.home_view ),
url(r'^login/$', website.views.login_view),
url(r'^login/usernames$', website.views.userlistForAutocompletion),
url(r'^logout/$', website.views.logout_view),
url(r'^', include(website.urls) ),
url(r'^events/', include( eventplanner.urls.urlpatterns) ),
url(r'^musicians/', include( musicians.urls.urlpatterns) ),
url(r'^messages/$', simpleforum.views.message_view ),
url(r'^admin/', include(admin.site.urls) ),
url(r'^location_field/', include('location_field.urls')),
url(r'^gallery/', include(imagestore.urls, namespace='imagestore') ),
) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)