Skip to content
This repository
Browse code

arkestra/example for Django 1.3 now works

  • Loading branch information...
commit d4d8dd6c228eaa6cd69a8c3ed2e3e3fd6cc15c6c 1 parent ffe5659
Daniele Procida authored
17 example/arkestra_settings.py
@@ -2,7 +2,6 @@
2 2 # They are not just Arkestra settings, but settings for other applications
3 3 # that Arkestra requires to be just so.
4 4
5   -from arkestra_utilities.settings import *
6 5
7 6 # These are the only settings you really need.
8 7 # If you need to modify other aspects of Arkestra's behaviour, see the
@@ -36,22 +35,6 @@
36 35 from settings import STATIC_URL
37 36 SEMANTICEDITOR_MEDIA_URL = os.path.join(STATIC_URL, "semanticeditor/")
38 37
39   -PAGE_TITLE_HEADING_LEVEL = 2
40   -
41   -# ensure that the highest_page_body_heading_level is made available below
42   -
43   -WYM_CONTAINERS = ",\n".join([
44   - "{'name': 'P', 'title': 'Paragraph', 'css': 'wym_containers_p'}",
45   -# "{'name': 'H1', 'title': 'Heading_1', 'css': 'wym_containers_h1'}", # I assume you reserve <h1> for your page templates
46   - "{'name': 'H2', 'title': 'Heading_2', 'css': 'wym_containers_h2'}",
47   - "{'name': 'H3', 'title': 'Heading_3', 'css': 'wym_containers_h3'}",
48   - "{'name': 'H4', 'title': 'Heading_4', 'css': 'wym_containers_h4'}",
49   - "{'name': 'H5', 'title': 'Heading_5', 'css': 'wym_containers_h5'}",
50   - "{'name': 'H6', 'title': 'Heading_6', 'css': 'wym_containers_h6'}",
51   -# "{'name': 'PRE', 'title': 'Preformatted', 'css': 'wym_containers_pre'}",
52   - "{'name': 'BLOCKQUOTE', 'title': 'Blockquote', 'css': 'wym_containers_blockquote'}",
53   - # "{'name': 'TH', 'title': 'Table_Header', 'css': 'wym_containers_th'}", # not ready for this yet
54   -])
55 38
56 39 # ------------------------ Link system
57 40
10,138 example/example_database.json
10,137 additions, 1 deletion not shown
185 example/settings.py
... ... @@ -1,4 +1,4 @@
1   -# Django settings for arkestra_medic project.
  1 +# Django settings for example project.
2 2
3 3 import os
4 4 import os.path
@@ -7,12 +7,17 @@
7 7 import sys
8 8 sys.path.append(os.path.join(os.path.dirname(__file__), '../'))
9 9
  10 +# set the BASE_PATH for convenience's sake
  11 +BASE_PATH = os.path.normpath(os.path.dirname(__file__))
  12 +
10 13 DEBUG = True
11 14 TEMPLATE_DEBUG = DEBUG
12 15
13   -# ------------------------ admin settings
  16 +ADMINS = (
  17 + # ('Your Name', 'your_email@example.com'),
  18 +)
14 19
15   -# ------------------------ databases
  20 +MANAGERS = ADMINS
16 21
17 22 DATABASES = {
18 23 'default': {
@@ -53,11 +58,11 @@
53 58 USE_I18N = True
54 59
55 60 # If you set this to False, Django will not format dates, numbers and
56   -# calendars according to the current locale
  61 +# calendars according to the current locale.
57 62 USE_L10N = True
58 63
59   -BASE_PATH = os.path.normpath(os.path.dirname(__file__))
60   -
  64 +# If you set this to False, Django will not use timezone-aware datetimes.
  65 +USE_TZ = False
61 66
62 67 # Absolute filesystem path to the directory that will hold user-uploaded files.
63 68 # Example: "/home/media/media.lawrence.com/media/"
@@ -135,16 +140,9 @@
135 140 'cms.middleware.page.CurrentPageMiddleware',
136 141 'cms.middleware.user.CurrentUserMiddleware',
137 142 'cms.middleware.toolbar.ToolbarMiddleware',
138   - )
139   -
140   -THUMBNAIL_PROCESSORS = (
141   - 'easy_thumbnails.processors.colorspace',
142   - 'easy_thumbnails.processors.autocrop',
143   - 'filer.thumbnail_processors.scale_and_crop_with_subject_location',
144   - 'easy_thumbnails.processors.filters',
145   - )
  143 +)
146 144
147   -ROOT_URLCONF = 'urls'
  145 +ROOT_URLCONF = 'example.urls'
148 146
149 147 TEMPLATE_DIRS = (
150 148 # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
@@ -153,6 +151,63 @@
153 151 BASE_PATH+'/templates/',
154 152 )
155 153
  154 +INSTALLED_APPS = (
  155 +
  156 + # Django CMS applications
  157 +
  158 + 'arkestra_utilities',
  159 + 'cms',
  160 + 'menus',
  161 + # 'appmedia',
  162 + 'cms.plugins.text',
  163 + 'cms.plugins.snippet',
  164 + 'sekizai',
  165 + # 'djcelery', # will need to be enabled for celery processing
  166 +
  167 + # Arkestra applications
  168 +
  169 + 'contacts_and_people',
  170 + 'vacancies_and_studentships',
  171 + 'news_and_events',
  172 + 'links',
  173 + 'arkestra_utilities.widgets.combobox',
  174 + 'arkestra_image_plugin',
  175 + 'video',
  176 + 'housekeeping',
  177 +
  178 + # other applications
  179 +
  180 + 'polymorphic',
  181 + 'semanticeditor',
  182 + 'mptt',
  183 + 'easy_thumbnails',
  184 + 'typogrify',
  185 + 'filer',
  186 + 'widgetry',
  187 + # 'south',
  188 + # 'adminsortable',
  189 +
  190 + # core Django applications
  191 + # these should be last, so we can override their templates
  192 +
  193 + 'django.contrib.auth',
  194 + 'django.contrib.contenttypes',
  195 + 'django.contrib.sessions',
  196 + 'django.contrib.sites',
  197 + 'django.contrib.messages',
  198 + 'django.contrib.staticfiles',
  199 + 'django.contrib.admin',
  200 + 'django.contrib.admindocs',
  201 + 'django.contrib.humanize',
  202 +)
  203 +
  204 +THUMBNAIL_PROCESSORS = (
  205 + 'easy_thumbnails.processors.colorspace',
  206 + 'easy_thumbnails.processors.autocrop',
  207 + 'filer.thumbnail_processors.scale_and_crop_with_subject_location',
  208 + 'easy_thumbnails.processors.filters',
  209 + )
  210 +
156 211 # ------------------------ Django Celery
157 212 try:
158 213 import djcelery
@@ -229,77 +284,33 @@
229 284 ('cy', gettext('Cymraeg')),
230 285 )
231 286
232   -INSTALLED_APPS = (
233   -
234   - # Django CMS applications
235   -
236   - 'arkestra_utilities',
237   - 'cms',
238   - 'menus',
239   - # 'appmedia',
240   - 'cms.plugins.text',
241   - 'cms.plugins.snippet',
242   - 'sekizai',
243   - # 'djcelery', # will need to be enabled for celery processing
244   -
245   - # Arkestra applications
246   -
247   - 'contacts_and_people',
248   - 'vacancies_and_studentships',
249   - 'news_and_events',
250   - 'links',
251   - 'arkestra_utilities.widgets.combobox',
252   - 'arkestra_image_plugin',
253   - 'video',
254   - 'housekeeping',
255   -
256   - # other applications
257   -
258   - 'polymorphic',
259   - 'semanticeditor',
260   - 'mptt',
261   - 'easy_thumbnails',
262   - 'typogrify',
263   - 'filer',
264   - 'widgetry',
265   - # 'south',
266   - # 'adminsortable',
267   -
268   - # core Django applications
269   -
270   - 'django.contrib.auth',
271   - 'django.contrib.contenttypes',
272   - 'django.contrib.sessions',
273   - 'django.contrib.sites',
274   - 'django.contrib.messages',
275   - 'django.contrib.staticfiles',
276   - 'django.contrib.admin',
277   - 'django.contrib.admindocs',
278   - 'django.contrib.humanize',
279   - 'django.contrib.staticfiles',
280   -)
281   -
282   -# A sample logging configuration. The only tangible logging
283   -# performed by this configuration is to send an email to
284   -# the site admins on every HTTP 500 error.
285   -# See http://docs.djangoproject.com/en/dev/topics/logging for
286   -# more details on how to customize your logging configuration.
287   -LOGGING = {
288   - 'version': 1,
289   - 'disable_existing_loggers': False,
290   - 'handlers': {
291   - 'mail_admins': {
292   - 'level': 'ERROR',
293   - 'class': 'django.utils.log.AdminEmailHandler'
294   - }
295   - },
296   - 'loggers': {
297   - 'django.request': {
298   - 'handlers': ['mail_admins'],
299   - 'level': 'ERROR',
300   - 'propagate': True,
301   - },
302   - }
303   -}
  287 +# ------------------------ WYMeditor/SemanticEditor
  288 +
  289 +# these override the settings in cms.plugins.text.settings
  290 +
  291 +WYM_TOOLS = ",\n".join([
  292 + "{'name': 'Italic', 'title': 'Emphasis', 'css': 'wym_tools_emphasis'}",
  293 + "{'name': 'Bold', 'title': 'Strong', 'css': 'wym_tools_strong'}",
  294 + "{'name': 'InsertOrderedList', 'title': 'Ordered_List', 'css': 'wym_tools_ordered_list'}",
  295 + "{'name': 'InsertUnorderedList', 'title': 'Unordered_List', 'css': 'wym_tools_unordered_list'}",
  296 + "{'name': 'Indent', 'title': 'Indent', 'css': 'wym_tools_indent'}",
  297 + "{'name': 'Outdent', 'title': 'Outdent', 'css': 'wym_tools_outdent'}",
  298 + "{'name': 'Undo', 'title': 'Undo', 'css': 'wym_tools_undo'}",
  299 + "{'name': 'Redo', 'title': 'Redo', 'css': 'wym_tools_redo'}",
  300 + "{'name': 'ToggleHtml', 'title': 'HTML', 'css': 'wym_tools_html'}",
  301 +])
  302 +
  303 +WYM_CONTAINERS = ",\n".join([
  304 + "{'name': 'P', 'title': 'Paragraph', 'css': 'wym_containers_p'}",
  305 + # "{'name': 'H1', 'title': 'Heading_1', 'css': 'wym_containers_h1'}", # I assume you reserve <h1> for your page templates
  306 + "{'name': 'H2', 'title': 'Heading_2', 'css': 'wym_containers_h2'}",
  307 + "{'name': 'H3', 'title': 'Heading_3', 'css': 'wym_containers_h3'}",
  308 + "{'name': 'H4', 'title': 'Heading_4', 'css': 'wym_containers_h4'}",
  309 + "{'name': 'H5', 'title': 'Heading_5', 'css': 'wym_containers_h5'}",
  310 + "{'name': 'H6', 'title': 'Heading_6', 'css': 'wym_containers_h6'}",
  311 +# "{'name': 'PRE', 'title': 'Preformatted', 'css': 'wym_containers_pre'}",
  312 + "{'name': 'BLOCKQUOTE', 'title': 'Blockquote', 'css': 'wym_containers_blockquote'}",
  313 + # "{'name': 'TH', 'title': 'Table_Header', 'css': 'wym_containers_th'}", # not ready for this yet
  314 +])
304 315
305 316 from arkestra_settings import *# import pdb; pdb.set_trace()
3  news_and_events/tests.py
@@ -7,7 +7,6 @@
7 7
8 8 # we're testing the behaviour of a method that uses date-related functions
9 9 import datetime
10   -from django.utils import timezone
11 10
12 11 from models import NewsArticle
13 12 from contacts_and_people.models import Entity
@@ -27,7 +26,7 @@ def setUp(self):
27 26 self.tootharticle = NewsArticle(
28 27 title = "All about teeth",
29 28 slug = "all-about-teeth",
30   - date = timezone.now() + datetime.timedelta(days=30),
  29 + date = datetime.datetime.now() + datetime.timedelta(days=30),
31 30 )
32 31 print self.tootharticle.date
33 32 def test_generic_attributes(self):
5 news_and_events/views.py
... ... @@ -1,7 +1,8 @@
  1 +import datetime
  2 +
1 3 from django.shortcuts import render_to_response, get_object_or_404
2 4 from django.template import RequestContext
3 5 from django.http import Http404
4   -from django.utils import timezone
5 6
6 7 from contacts_and_people.models import Entity
7 8 from links.link_functions import object_links
@@ -160,7 +161,7 @@ def newsarticle(request, slug):
160 161 if request.user.is_staff:
161 162 newsarticle = get_object_or_404(NewsArticle, slug=slug)
162 163 else:
163   - newsarticle = get_object_or_404(NewsArticle, slug=slug, published=True, date__lte=timezone.now())
  164 + newsarticle = get_object_or_404(NewsArticle, slug=slug, published=True, date__lte=datetime.datetime.now())
164 165 return render_to_response(
165 166 "news_and_events/newsarticle.html",
166 167 {

1 comment on commit d4d8dd6

Daniele Procida
Owner

tests don't work in Django 1.3 though because of override_settings

Please sign in to comment.
Something went wrong with that request. Please try again.