Changeset 4789
- Timestamp:
- 03/23/07 14:31:37 (2 years ago)
- Files:
-
- djangoproject.com/django_website/apps/docs/builder.py (added)
- djangoproject.com/django_website/apps/docs/models.py (modified) (1 diff)
- djangoproject.com/django_website/apps/docs/parts (deleted)
- djangoproject.com/django_website/apps/docs/smartypants.py (added)
- djangoproject.com/django_website/apps/docs/urls.py (modified) (1 diff)
- djangoproject.com/django_website/apps/docs/views.py (added)
- djangoproject.com/django_website/settings.py (modified) (3 diffs)
- djangoproject.com/django_website/sitemaps.py (modified) (2 diffs)
- djangoproject.com/django_website/templates/docs/detail.html (moved) (moved from djangoproject.com/django_website/templates/docs/document_detail.html) (1 diff)
- djangoproject.com/django_website/templates/docs/index.html (added)
- djangoproject.com/django_website/templates/docs/model_detail.html (added)
- djangoproject.com/django_website/templates/docs/model_index.html (added)
- djangoproject.com/django_website/templates/flatfiles/docs.html (modified) (1 diff)
- djangoproject.com/django_website/urls.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
djangoproject.com/django_website/apps/docs/models.py
r3008 r4789 1 1 from django.db import models 2 2 3 class Document(models.Model): 4 title = models.CharField(maxlength=200) 5 slug = models.CharField(maxlength=50, unique=True, prepopulate_from=('title',)) 6 doc_path = models.CharField(maxlength=200, 7 help_text="Relative to the docs directory in django SVN. Leave off the file extension.") 8 last_updated = models.DateTimeField(auto_now=True) 9 3 class DocumentRelease(models.Model): 4 version = models.CharField(maxlength=20, unique=True) 5 repository_path = models.CharField(maxlength=50, help_text="(i.e. 'tags/releases/0.95' or 'branches/0.95-bugfixes')") 6 release_date = models.DateField() 7 10 8 class Meta: 11 db_table = 'docs_documents' 12 ordering = ('title',) 13 9 ordering = ('-release_date',) 10 14 11 class Admin: 15 fields = ( 16 (None, {'fields': ('title', 'slug', 'doc_path')}), 17 ) 18 list_display = ('title', 'doc_path') 19 12 list_display = ("version", "repository_path", "release_date") 13 20 14 def __str__(self): 21 return self. title22 15 return self.version 16 23 17 def get_absolute_url(self): 24 return "/documentation/%s/" % self.slug 25 26 def get_content(self): 27 try: 28 return self._doc_content 29 except AttributeError: 30 import os 31 from django.conf import settings 32 doc_path = os.path.join(settings.DJANGO_DOCUMENT_ROOT_PATH, "%s.html" % self.doc_path) 33 if os.path.exists(doc_path): 34 self._doc_content = open(doc_path).read() 35 else: 36 self._doc_content = '' 37 return self._doc_content 38 39 def get_toc(self): 40 try: 41 return self._toc_content 42 except AttributeError: 43 import os 44 from django.conf import settings 45 toc_path = os.path.join(settings.DJANGO_DOCUMENT_ROOT_PATH, "%s_toc.html" % self.doc_path) 46 if os.path.exists(toc_path): 47 self._toc_content = open(toc_path).read() 48 else: 49 self._toc_content = '' 50 return self._toc_content 18 return "/documentation/%s/" % (self.version) 19 djangoproject.com/django_website/apps/docs/urls.py
r3008 r4789 1 1 from django.conf.urls.defaults import * 2 from models import Document # relative import3 2 4 info_dict = { 5 'queryset': Document.objects.all(), 6 'slug_field': 'slug', 7 } 8 9 urlpatterns = patterns('django.views.generic.list_detail', 10 (r'^(?P<slug>[\w\/]+)/$', 'object_detail', info_dict), 3 urlpatterns = patterns('django_website.apps.docs.views', 4 (r'^$', 'doc_index'), 5 (r'^(?P<version>[\d.]+)/$', 'doc_index'), 6 (r'^models/$', 'model_index'), 7 (r'^models/(?P<slug>\w+)/$', 'model_detail'), 8 (r'^(?P<version>[\d.]+)/models/$', 'model_index'), 9 (r'^(?P<version>[\d.]+)/models/(?P<slug>\w+)/$', 'model_detail'), 10 (r'^(?P<slug>[\w-]+)/$', 'doc_detail'), 11 (r'^(?P<version>[\d.]+)/(?P<slug>[\w-]+)/$', 'doc_detail'), 11 12 ) djangoproject.com/django_website/settings.py
r3703 r4789 1 # from worldonline.settings.default import * 1 import os, platform 2 3 # Far too clever trick to know if we're running on the deployment server. 4 DEVELOPMENT_MODE = ("servers.ljworld.com" not in platform.node()) 2 5 3 6 ADMINS = (('Adrian Holovaty','holovaty@gmail.com'), ('Jacob Kaplan-Moss', 'jacob@lawrence.com')) … … 7 10 MANAGERS = (('Wilson Miner','wminer@ljworld.com'),) 8 11 9 DEBUG = False 10 PREPEND_WWW = True 11 12 DATABASE_ENGINE = 'postgresql' 13 DATABASE_NAME = 'djangoproject' 14 DATABASE_USER = 'apache' 15 DATABASE_PASSWORD = '' 16 DATABASE_HOST = '10.0.0.80' # set to empty string for localhost 12 if DEVELOPMENT_MODE: 13 DEBUG = True 14 PREPEND_WWW = False 15 DATABASE_ENGINE = "sqlite3" 16 DATABASE_NAME = "/tmp/djangoproject.db" 17 CACHE_BACKEND = "file:///tmp/djangoprojectcache/" 18 TEMPLATE_DIRS = [os.path.join(os.path.dirname(__file__), "templates")] 19 DJANGO_SVN_ROOT = "http://code.djangoproject.com/svn/django/" 20 else: 21 DEBUG = False 22 PREPEND_WWW = True 23 DATABASE_ENGINE = 'postgresql' 24 DATABASE_NAME = 'djangoproject' 25 DATABASE_USER = 'apache' 26 DATABASE_PASSWORD = '' 27 DATABASE_HOST = '10.0.0.80' # set to empty string for localhost 28 CACHE_BACKEND = 'memcached://127.0.0.1:11211/' 29 TEMPLATE_DIRS = ['/home/html/templates/djangoproject.com/'] 30 DJANGO_SVN_ROOT = "file:///home/svn/django/django/" 17 31 18 32 SITE_ID = 1 19 TEMPLATE_DIRS = (20 '/home/html/templates/djangoproject.com/',21 )22 33 ROOT_URLCONF = 'django_website.urls' 23 34 INSTALLED_APPS = ( … … 43 54 DJANGO_TESTS_PATH = "/home/html/djangoproject.com/tests/" 44 55 45 CACHE_BACKEND = 'memcached://127.0.0.1:11211/'46 47 56 CACHE_MIDDLEWARE_SECONDS = 60 * 60 * 1 # 1 hour 48 57 CACHE_MIDDLEWARE_KEY_PREFIX = 'djangoproject' djangoproject.com/django_website/sitemaps.py
r3704 r4789 1 1 from django.contrib.sitemaps import Sitemap 2 2 from django_website.apps.blog.models import Entry 3 from django_website.apps.docs.models import Document4 3 from django.contrib.flatpages.models import FlatPage 5 4 import datetime … … 39 38 # We'd rather not look up the date of the latest comment -- not worth the overhead. 40 39 41 class DocumentationSitemap(Sitemap):42 changefreq = 'weekly'43 priority = 0.844 45 def items(self):46 return Document.objects.all()47 48 # lastmod is not implemented, because documentation contains comments.49 # We'd rather not look up the date of the latest comment -- not worth the overhead.djangoproject.com/django_website/templates/docs/detail.html
r4783 r4789 1 1 {% extends "base_docs.html" %} 2 2 3 {% block title %} Documentation | {{ object.title }}{% endblock %}3 {% block title %}{{ doc.title }} | Django Documentation{% endblock %} 4 4 5 5 {% block content %} 6 {{ object.get_content }} 6 <h1>{{ doc.title }}</h1> 7 7 8 {% load comments %} 9 {% get_free_comment_list for docs.document object.id as comment_list %} 8 <h2 class="deck"> 9 {% ifequal version "trunk" %} 10 This document is for Django's SVN release, which can be 11 significantly different than previous releases. Get old docs here: 12 {% for r in all_versions %} 13 <a href="../{{ r.version }}/{{ slug }}/">{{ r.version }}</a>{% if forloop.last %}.{% else %},{% endif %} 14 {% endfor %} 15 {% else %} 16 This document describes Django version {{ version }}. For current documentation, 17 <a href="/documentation/{{ slug }}/">go here</a>. 18 {% endifequal %} 19 </h2> 20 21 {{ doc.body }} 10 22 11 23 <div id="content-secondary"> 12 <h2 id="comments">Comments</h2> 13 14 {% for comment in comment_list %} 15 <div class="comment" id="c{{ comment.id }}"> 16 <h3>{{ comment.person_name|escape }} <span class="small quiet">{{ comment.submit_date|date:"F j, Y" }} at {{ comment.submit_date|date:"P" }}</span></h3> 17 {{ comment.comment|escape|urlizetrunc:"40"|linebreaks }} 18 </div> 19 {% endfor %} 20 21 <h2>Post a comment</h2> 22 23 <p class="small quiet"><strong>Note:</strong> Please only use the comments for 24 questions/criticisms/suggestions on the docs. This is <strong>not</strong> the place 25 to ask technical support questions. For tech support, ask in the IRC 26 channel or post to the <a href="http://groups-beta.google.com/group/django-users"> 27 django-users list</a>. Comments will be periodically reviewed, integrated into 28 the documentation proper and removed.</p> 29 30 {% free_comment_form for docs.document object.id %} 24 <h2 id="comments">Questions/Feedback</h2> 25 <p> 26 If you notice errors with this documentmentation, please <a 27 href="http://code.djangoproject.com/simpleticket?component=Documentation"> 28 open a ticket</a> and let us know! 29 </p> 30 <p> 31 Please only use the ticket tracker for criticisms and improvements on the 32 docs. For tech support, ask in the IRC channel or post to the <a 33 href="http://groups-beta.google.com/group/django-users"> django-users 34 list</a>. 35 </p> 31 36 </div> 32 37 {% endblock %} 33 38 34 {% block content-related %}<h2>Contents</h2>{{ object.get_toc }}{% endblock %} 39 {% block content-related %} 40 <h2>Contents</h2> 41 {{ doc.toc }} 42 {% endblock %} djangoproject.com/django_website/templates/flatfiles/docs.html
r4401 r4789 3 3 {% block content %} 4 4 <h1>{{ flatpage.title }}</h1> 5 6 {% ifequal version "trunk" %} 7 8 {% endifequal %} 5 9 6 10 {{ flatpage.content }} djangoproject.com/django_website/urls.py
r3705 r4789 6 6 from django_website.apps.aggregator.models import FeedItem 7 7 from django_website.apps.blog.feeds import WeblogEntryFeed 8 from django_website.sitemaps import FlatPageSitemap, WeblogSitemap , DocumentationSitemap8 from django_website.sitemaps import FlatPageSitemap, WeblogSitemap 9 9 from django.views.decorators.cache import cache_page 10 10 … … 27 27 sitemaps = { 28 28 'weblog': WeblogSitemap, 29 'docs': DocumentationSitemap,30 29 'flatpages': FlatPageSitemap, 31 30 }
