From 07114a5a90e5feb640f0885727b07d815a621314 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Thu, 18 Sep 2014 18:10:47 +0200 Subject: [PATCH] from foundation to bootstrap, test pure-pagination --- example/sandbox/manage.py | 16 +++---- example/sandbox/settings.py | 27 +++++++++++- example/sandbox/urls.py | 8 ++-- setup.py | 1 + telemeta/forms/media.py | 18 ++++++-- telemeta/static/telemeta/css/telemeta.css | 43 ++++++++++++------- telemeta/templates/telemeta/base.html | 30 +++++++------ .../templates/telemeta/inc/resource_list.html | 3 +- telemeta/views/resource.py | 3 +- 9 files changed, 99 insertions(+), 50 deletions(-) diff --git a/example/sandbox/manage.py b/example/sandbox/manage.py index bcdd55e2..c632a8a3 100755 --- a/example/sandbox/manage.py +++ b/example/sandbox/manage.py @@ -1,11 +1,9 @@ -#!/usr/bin/python -from django.core.management import execute_manager -try: - import settings # Assumed to be in the same directory. -except ImportError: - import sys - 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__) - sys.exit(1) +#!/usr/bin/env python +import os, sys if __name__ == "__main__": - execute_manager(settings) + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") + + from django.core.management import execute_from_command_line + + execute_from_command_line(sys.argv) diff --git a/example/sandbox/settings.py b/example/sandbox/settings.py index dbdc53ae..798f661f 100644 --- a/example/sandbox/settings.py +++ b/example/sandbox/settings.py @@ -66,7 +66,7 @@ MEDIA_URL = '/media/' # Don't put anything in this directory yourself; store your static files # in apps' "static/" subdirectories and in STATICFILES_DIRS. # Example: "/home/media/media.lawrence.com/static/" -STATIC_ROOT = '/var/www/static/' +STATIC_ROOT = '' # URL prefix for static files. # Example: "http://media.lawrence.com/static/" @@ -104,9 +104,10 @@ MIDDLEWARE_CLASSES = ( 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.locale.LocaleMiddleware', + # 'pagination.middleware.PaginationMiddleware', ) -ROOT_URLCONF = 'sandbox.urls' +ROOT_URLCONF = 'urls' TEMPLATE_DIRS = ( # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". @@ -130,6 +131,12 @@ INSTALLED_APPS = ( 'sorl.thumbnail', 'timezones', 'jqchat', + 'extra_views', + # 'pagination', + # 'breadcrumbs', + 'debug_toolbar', + 'bootstrap3', + 'pure_pagination', ) TEMPLATE_CONTEXT_PROCESSORS = ( @@ -138,6 +145,7 @@ TEMPLATE_CONTEXT_PROCESSORS = ( "django.core.context_processors.i18n", "django.core.context_processors.media", 'django.core.context_processors.static', + 'django.contrib.messages.context_processors.messages', ) TELEMETA_ORGANIZATION = 'Parisson' @@ -165,3 +173,18 @@ DEFAULT_FROM_EMAIL = 'webmaster@parisson.com' TIMESIDE_DEFAULT_GRAPHER_ID = 'waveform_centroid' TIMESIDE_AUTO_ZOOM = True + +# Settings for django-bootstrap3 +BOOTSTRAP3 = { + 'set_required': False, + 'error_css_class': 'bootstrap3-error', + 'required_css_class': 'bootstrap3-required', + 'javascript_in_head': True, +} + +SESSION_EXPIRE_AT_BROWSER_CLOSE = False + +PAGINATION_SETTINGS = { + 'PAGE_RANGE_DISPLAYED': 10, + 'MARGIN_PAGES_DISPLAYED': 2, +} diff --git a/example/sandbox/urls.py b/example/sandbox/urls.py index fb0665ee..e9301341 100644 --- a/example/sandbox/urls.py +++ b/example/sandbox/urls.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from django.conf.urls.defaults import * +from django.conf.urls import patterns, url, include # Uncomment the next two lines to enable the admin: from django.contrib import admin @@ -19,11 +19,11 @@ urlpatterns = patterns('', # Uncomment the next line to enable the admin: (r'^admin/django/', include(admin.site.urls)), - + # Telemeta (r'^', include('telemeta.urls')), - + # Languages - (r'^i18n/', include('django.conf.urls.i18n')), + (r'^i18n/', include('django.conf.urls.i18n')), (r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict), ) diff --git a/setup.py b/setup.py index 7bb4762c..8f16f0fb 100644 --- a/setup.py +++ b/setup.py @@ -43,6 +43,7 @@ setup( 'django-extra-views', 'django-ajax-selects', 'django-breadcrumbs', + 'django-pagination', ], dependency_links = ['https://github.com/yomguy/django-json-rpc/tarball/0.6.2', 'https://github.com/elo80ka/django-dynamic-formset/tarball/master', diff --git a/telemeta/forms/media.py b/telemeta/forms/media.py index 60639cfc..785551bd 100644 --- a/telemeta/forms/media.py +++ b/telemeta/forms/media.py @@ -34,16 +34,20 @@ import django.forms as forms from django.forms import ModelForm +from django.contrib.admin.widgets import FilteredSelectMultiple from telemeta.models import * from extra_views import CreateWithInlinesView, UpdateWithInlinesView, InlineFormSet from extra_views.generic import GenericInlineFormSet class MediaFondsForm(ModelForm): - children = forms.ModelMultipleChoiceField(widget=forms.CheckboxSelectMultiple, queryset=MediaCorpus.objects.all()) + widget = FilteredSelectMultiple("Verbose name", is_stacked=False) + field = forms.ModelMultipleChoiceField(queryset=MediaCorpus.objects.all()) + children = forms.ModelMultipleChoiceField(widget=widget, queryset=field) class Meta: model = MediaFonds + exclude = ['description',] class MediaFondsRelatedForm(ModelForm): @@ -52,10 +56,18 @@ class MediaFondsRelatedForm(ModelForm): class MediaCorpusForm(ModelForm): - children = forms.ModelMultipleChoiceField(widget=forms.CheckboxSelectMultiple, - queryset=MediaCollection.objects.all()) + # queryset = MediaCollection.objects.all() + # widget = FilteredSelectMultiple('children', False) + # # # field = forms.ModelMultipleChoiceField(queryset=MediaCorpus.objects.all()) + # children = forms.ModelMultipleChoiceField(widget=widget, queryset=queryset, required=True) + class Meta: model = MediaCorpus + exclude = ['description',] + + class Media: + css = {'all': ('/static/admin/css/widgets.css',),} + js = ('/admin/django/jsi18n/',) class MediaCorpusRelatedForm(ModelForm): diff --git a/telemeta/static/telemeta/css/telemeta.css b/telemeta/static/telemeta/css/telemeta.css index 26f77425..3f031ab0 100644 --- a/telemeta/static/telemeta/css/telemeta.css +++ b/telemeta/static/telemeta/css/telemeta.css @@ -1,11 +1,10 @@ body {margin: 0; padding: 0;} - a {text-decoration: none; color: #969696;} a img {border: none;} body { - font: 0.8125em/1em verdana, sans-serif; + font: 0.9em/1em verdana, sans-serif; line-height: 1.3em; color: #333; background: #FFF; @@ -51,6 +50,12 @@ a img { border: none; } font-weight: bold; color: #353535; } + +.rst-content p { + font-size: 0.9em; + text-align: justify; +} + .nett { clear: both; height: 5px; @@ -69,16 +74,14 @@ a img { border: none; } #content { /*margin-top: 1em;*/ margin-bottom: 0em; -} - -#content { position: relative; margin-left: 2em; margin-right: 2em; -} + /*font-size: 1.3em;*/ +} -#content ul, #content ul ul, #content ol { +/*#content ul, #content ul ul, #content ol { list-style: square; padding: .7em; padding-left: 2em; @@ -96,21 +99,27 @@ a img { border: none; } #content li a { padding: .1em 0; } + +*/ + #content h1 { color: #6a0307; font-weight: bold; display: inline; font-size: 120%; } + +#content h2 { + color: #6a0307; +} + #content h3 { color: #6a0307; font-weight: bold; display: inline; + font-size: 1.2em; } -#content h2 { - color: #6a0307; -} #logo a, #logo a:hover { border: none; background: transparent; } @@ -335,7 +344,7 @@ label.disabled { color: #d7d7d7 } } #quick_search_pattern { - background: #FFF url(search_bg.png) no-repeat; + background-color: white; padding: .4em .1em; width: 180px; color: #555; @@ -343,6 +352,10 @@ label.disabled { color: #d7d7d7 } float: left; } +#quick-search-button{ + float: right; +} + /* Authentication */ #auth_info { color: #FFF; @@ -648,7 +661,7 @@ dl.listing dt.group { } dl.listing dd { margin-left: 19.4em; - font-weight: bold; + /*font-weight: bold;*/ } /* dublin core display */ @@ -710,12 +723,11 @@ dl.dublincore dd.caption { .infos dl, .infos table { position: relative; - font-size: 105%; } .extraInfos dl, .extraInfos table { position: relative; - font-size: 105%; + } .extraInfos div { @@ -1148,7 +1160,7 @@ a.image-link { color:#444; text-decoration: none; margin:0; - font: 0.9em/1.2em sans-serif; + font: 0.8em/1.2em sans-serif; } .component + .component, .component + .component_icon, .component_icon + .component , .component_icon + .component_icon{ @@ -1295,3 +1307,4 @@ a:focus,div:focus{ width: 66%; float: left; } + diff --git a/telemeta/templates/telemeta/base.html b/telemeta/templates/telemeta/base.html index 4cbabbd5..2238cbcf 100644 --- a/telemeta/templates/telemeta/base.html +++ b/telemeta/templates/telemeta/base.html @@ -1,6 +1,7 @@ {% load i18n %} -{% load telemeta_utils %} +{% load telemeta_utils %}{# Load the tag library #} +{% load bootstrap3 %} {% get_current_language as LANGUAGE_CODE %} {% get_available_languages as LANGUAGES %} @@ -14,9 +15,8 @@ {%block head_title %}{% description %} - Telemeta{% endblock %} {% block stylesheets %} - - +