Django

Code

Changeset 9073

Show
Ignore:
Timestamp:
09/19/08 15:49:50 (2 months ago)
Author:
jacob
Message:

[djangoproject.com] updated website to use Django 1.0.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • djangoproject.com

    • Property svn:externals changed from
      django -r6063 http://code.djangoproject.com/svn/django/trunk/django/
      registration -r139 http://django-registration.googlecode.com/svn/trunk/registration/
      comment_utils -r78 http://django-comment-utils.googlecode.com/svn/trunk/comment_utils/
      contact_form -r48 http://django-contact-form.googlecode.com/svn/trunk/contact_form/
      to
      django http://code.djangoproject.com/svn/django/tags/releases/1.0/django
      registration -r168 http://django-registration.googlecode.com/svn/trunk/registration/
      contact_form -r49 http://django-contact-form.googlecode.com/svn/trunk/contact_form/
  • djangoproject.com/djangodocs/forms.py

    r8844 r9073  
    1 from django import newforms as forms 
     1from django import forms 
    22 
    33AS_Q_CHOICES = ( 
  • djangoproject.com/djangodocs/templates/docs/doc.html

    r8926 r9073  
    3939 
    4040{% block body %} 
    41   {{ doc.body }} 
     41  {{ doc.body|safe }} 
    4242{% endblock %} 
    4343 
     
    7676    <h2>Contents</h2> 
    7777    {% block toc %} 
    78       {{ doc.toc }} 
     78      {{ doc.toc|safe }} 
    7979    {% endblock %} 
    8080  {% endblock %} 
  • djangoproject.com/djangodocs/templates/docs/search_form.html

    r8844 r9073  
    1010  </div> 
    1111</form> 
    12 <script type="text/javascript" src="http://www.google.com/coop/cse/brand?form={{ search_form_id|escape }}&lang={{ lang|escape }}"></script> 
     12<script type="text/javascript" src="http://www.google.com/coop/cse/brand?form={{ search_form_id|escape }}&amp;lang={{ lang|escape }}"></script> 
  • djangoproject.com/django_website/apps/aggregator/models.py

    r7892 r9073  
    22 
    33class Feed(models.Model): 
    4     title = models.CharField(maxlength=500) 
    5     feed_url = models.URLField(unique=True, maxlength=500) 
    6     public_url = models.URLField(maxlength=500) 
     4    title = models.CharField(max_length=500) 
     5    feed_url = models.URLField(unique=True, max_length=500) 
     6    public_url = models.URLField(max_length=500) 
    77    is_defunct = models.BooleanField() 
    88 
    99    class Meta: 
    1010        db_table = 'aggregator_feeds' 
    11  
    12     class Admin: 
    13         list_display = ["title", "public_url", "is_defunct"] 
    14         list_filter = ["is_defunct"] 
    15         ordering = ["title"] 
    16         search_fields = ["title", "public_url"] 
    17         list_per_page = 500 
    1811 
    1912    def __unicode__(self): 
     
    2215class FeedItem(models.Model): 
    2316    feed = models.ForeignKey(Feed) 
    24     title = models.CharField(maxlength=500) 
    25     link = models.URLField(maxlength=500) 
     17    title = models.CharField(max_length=500) 
     18    link = models.URLField(max_length=500) 
    2619    summary = models.TextField(blank=True) 
    2720    date_modified = models.DateTimeField() 
    28     guid = models.CharField(maxlength=500, unique=True, db_index=True) 
     21    guid = models.CharField(max_length=500, unique=True, db_index=True) 
    2922 
    3023    class Meta: 
  • djangoproject.com/django_website/apps/blog/models.py

    r6472 r9073  
     1import akismet 
    12import datetime 
     3from django.conf import settings 
    24from django.db import models 
    3 from comment_utils.moderation import CommentModerator, moderator 
     5from django.contrib.sites.models import Site 
     6from django.contrib.comments.signals import comment_was_posted 
     7from django.utils.encoding import smart_str 
    48 
    59class Entry(models.Model): 
    610    pub_date = models.DateTimeField() 
    711    slug = models.SlugField(unique_for_date='pub_date') 
    8     headline = models.CharField(maxlength=200) 
     12    headline = models.CharField(max_length=200) 
    913    summary = models.TextField(help_text="Use raw HTML.") 
    1014    body = models.TextField(help_text="Use raw HTML.") 
    11     author = models.CharField(maxlength=100) 
     15    author = models.CharField(max_length=100) 
    1216 
    1317    class Meta: 
     
    1620        ordering = ('-pub_date',) 
    1721        get_latest_by = 'pub_date' 
    18  
    19     class Admin: 
    20         list_display = ('pub_date', 'headline', 'author') 
    2122 
    2223    def __unicode__(self): 
     
    3132        return delta.days < 60 
    3233 
    33 class EntryModerator(CommentModerator): 
    34     akismet = True 
    35     enable_field = "comments_enabled" 
    36  
    37 moderator.register(Entry, EntryModerator) 
     34def moderate_comment(sender, comment, request, **kwargs): 
     35    ak = akismet.Akismet( 
     36        key = settings.AKISMET_API_KEY, 
     37        blog_url = 'http://%s/' % Site.objects.get_current().domain 
     38    ) 
     39    data = { 
     40        'user_ip': request.META.get('REMOTE_ADDR', '127.0.0.1'), 
     41        'user_agent': request.META.get('HTTP_USER_AGENT', ''), 
     42        'referrer': request.META.get('HTTP_REFERRER', ''), 
     43        'comment_type': 'comment', 
     44        'comment_author': smart_str(comment.user_name), 
     45    } 
     46    if ak.comment_check(smart_str(comment.comment), data=data, build_data=True): 
     47        comment.is_public = False 
     48        comment.save() 
     49     
     50comment_was_posted.connect(moderate_comment) 
  • djangoproject.com/django_website/apps/contact/forms.py

    r8468 r9073  
    11import textwrap 
    2 from django import newforms as forms 
     2from django import forms 
    33from contact_form.forms import AkismetContactForm 
    44 
  • djangoproject.com/django_website/apps/docs/models.py

    r6063 r9073  
    22 
    33class 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')") 
     4    version = models.CharField(max_length=20, unique=True) 
     5    repository_path = models.CharField(max_length=50, help_text="(i.e. 'tags/releases/0.95' or 'branches/0.95-bugfixes')") 
    66    release_date = models.DateField() 
    77     
  • djangoproject.com/django_website/settings.py

    r7898 r9073  
    1919    CACHE_BACKEND = "dummy:///" 
    2020    DJANGO_SVN_ROOT = "http://code.djangoproject.com/svn/django/" 
     21    ADMIN_MEDIA_PREFIX = '/media/' 
    2122else: 
    2223    DEBUG = False 
     
    2627    TEMPLATE_DIRS = ['/home/djangoproject.com/django_website/templates'] 
    2728    DJANGO_SVN_ROOT = "file:///home/svn/django/django/" 
     29    ADMIN_MEDIA_PREFIX = 'http://media.djangoproject.com/admin/' 
    2830 
    2931SITE_ID = 1 
     
    4446    'django_website.apps.aggregator', 
    4547    'registration', 
    46     'comment_utils', 
    4748) 
    48 ADMIN_MEDIA_PREFIX = 'http://media.djangoproject.com/admin/' 
    4949MEDIA_ROOT = "/home/html/djangoproject.com/m/" 
    5050MEDIA_URL = "http://www.djangoproject.com.com/m/" 
  • djangoproject.com/django_website/templates/blog/entry_archive_day.html

    r3008 r9073  
    88 
    99{% for object in object_list %} 
    10 <h2><a href="{{ object.get_absolute_url }}">{{ object.headline }}</a></h2> 
     10<h2><a href="{{ object.get_absolute_url }}">{{ object.headline|safe }}</a></h2> 
    1111<p class="small date">{{ object.pub_date|date:"F j, Y" }}</p> 
    12 {{ object.body }} 
     12{{ object.body|safe }} 
    1313 
    1414{% endfor %} 
  • djangoproject.com/django_website/templates/blog/entry_archive.html

    r6526 r9073  
    33{% block content %} 
    44 
    5 {% load comments comment_utils %} 
    6  
    75<h1>Latest entries</h1> 
    86 
    97{% for object in latest %} 
    10     <h2><a href="{{ object.get_absolute_url }}">{{ object.headline }}</a></h2> 
    11     {{ object.body }} 
     8    <h2><a href="{{ object.get_absolute_url }}">{{ object.headline|safe }}</a></h2> 
     9    {{ object.body|safe }} 
    1210    <p class="date small">Posted by <strong>{{ object.author }}</strong> on {{ object.pub_date|date:"F j, Y" }}</p> 
    1311{% endfor %} 
  • djangoproject.com/django_website/templates/blog/entry_archive_month.html

    r3008 r9073  
    88 
    99{% for object in object_list %} 
    10 <h2><a href="{{ object.get_absolute_url }}">{{ object.headline }}</a></h2> 
     10<h2><a href="{{ object.get_absolute_url }}">{{ object.headline|safe }}</a></h2> 
    1111<p class="small date">{{ object.pub_date|date:"F j, Y" }}</p> 
    12 {{ object.body }} 
     12{{ object.body|safe }} 
    1313 
    1414{% endfor %} 
  • djangoproject.com/django_website/templates/blog/entry_detail.html

    r6526 r9073  
    55{% block content %} 
    66 
    7 <h1>{{ object.headline }}</h1> 
    8 {{ object.body }} 
     7<h1>{{ object.headline|safe }}</h1> 
     8{{ object.body|safe }} 
    99<p class="date small">Posted by <strong>{{ object.author }}</strong> on {{ object.pub_date|date:"F j, Y" }}</p> 
    1010 
    11 {% load comments comment_utils %} 
    12 {% get_public_free_comment_list for blog.entry object.id as comment_list %} 
     11{% load comments %} 
     12{% get_comment_list for blog.entry object.id as comment_list %} 
    1313 
    1414<div id="content-secondary"> 
     
    1717{% for comment in comment_list %} 
    1818<div class="comment" id="c{{ comment.id }}"> 
    19     <h3>{{ comment.person_name|escape }} <span class="small quiet">{{ comment.submit_date|date:"F j, Y" }} at {{ comment.submit_date|date:"P" }}</span></h3> 
     19    <h3>{{ comment.user_name|escape }} <span class="small quiet">{{ comment.submit_date|date:"F j, Y" }} at {{ comment.submit_date|date:"P" }}</span></h3> 
    2020    {{ comment.comment|escape|urlizetrunc:"40"|linebreaks }} 
    2121</div> 
     
    2424{% if object.comments_enabled %} 
    2525<h2>Post a comment</h2> 
    26 {% free_comment_form for blog.entry object.id %} 
     26{% render_comment_form for blog.entry object.id %} 
    2727{% else %} 
    2828<h2>Comments are closed</h2> 
  • djangoproject.com/django_website/templates/blog/entry_snippet.html

    r8925 r9073  
    22    <h3><a href="{{ e.get_absolute_url }}">{{ e.headline }}</a></h3> 
    33    <p class="date">by <strong>{{ e.author }}</strong> on {{ e.pub_date|date:"M. j, Y" }}</p> 
    4     {{ e.summary }} 
     4    {{ e.summary|safe }} 
    55    <p class="more"><a href="{{ e.get_absolute_url }}">Read more</a></p> 
    66{% endfor %} 
  • djangoproject.com/django_website/templates/contact/foundation.html

    r7895 r9073  
    33{% block title %}Contact the Django Software Foundation{% endblock %} 
    44 
    5 {% block extrahead %} 
    6   {{ block.super }} 
    7   <style type="text/css" media="screen"> 
    8     form.contact label { display: block; font-weight: bold; margin-top: 1.5em; margin-bottom: 0;} 
    9     form.contact label span { font-weight: normal; color: #555; } 
    10     form.contact input,  
    11     form.contact textarea,  
    12     form.contact select { width: 99%; padding: 1px; } 
    13     form.contact p { margin: 0; } 
    14     form.contact p.submit { text-align: right; margin-top: 1em; margin-right: 0;} 
    15     form.contact p.submit input { width: 10em; font-size: 1.5em; } 
    16     form.contact p.errors { margin: 0; padding: 0; font-weight: bold; color: red; } 
    17   </style> 
    18 {% endblock %} 
    19  
    205{% block content %} 
    216<h1>Contact the Django Software Foundation</h1> 
    22 <form action="." method="post" accept-charset="utf-8" class="contact"> 
     7<form action="." method="post" accept-charset="utf-8" class="wide"> 
    238  <p> 
    249    <label for="id_name">Your name:</label> 
  • djangoproject.com/django_website/templates/registration/registration_form.html

    r8925 r9073  
    66 
    77  {% if form.errors %} 
    8   <p class="error">Please correct the errors below: {{ form.non_field_errors }}</p> 
     8  <p class="errors">Please correct the errors below: {{ form.non_field_errors }}</p> 
    99  {% endif %} 
    1010 
    1111  <h1>Create an account</h1> 
    1212   
    13   <form method="post" action=""> 
    14     <dl> 
    15       <dt> 
    16         <label for="id_username">Username:</label> 
    17       </dt> 
    18       <dd> 
    19         {{ form.username }} 
    20         {% if form.username.errors %} 
    21           <span class="error">* {{ form.username.errors|join:", " }}</span> 
    22         {% endif %} 
    23       </dd> 
    24    
    25       <dt> 
    26         <label for="id_email">Email address:</label> 
    27       </dt> 
    28       <dd> 
    29         {{ form.email }} 
    30         {% if form.email.errors %} 
    31           <span class="error">* {{ form.email.errors|join:", " }}</span> 
    32         {% endif %} 
    33       </dd> 
    34    
    35       <dt> 
    36         <label for="id_password1">Password:</label> 
    37       </dt> 
    38       <dd> 
    39         {{ form.password1 }} 
    40         {% if form.password1.errors %} 
    41           <span class="error">* {{ form.password2.errors|join:", " }}</span> 
    42         {% endif %} 
    43       </dd> 
    44    
    45       <dt> 
    46         <label for="id_password2">Password (type again to catch typos):</label> 
    47       </dt> 
    48       <dd> 
    49         {{ form.password2 }} 
    50         {% if form.password2.errors %} 
    51           <span class="error">* {{ form.password2.errors|join:", " }}</span> 
    52         {% endif %} 
    53       </dd> 
    54  
    55       <dt><input type="submit" value="Register" /></dt> 
    56     </dl> 
     13  <form method="post" action="" class="wide"> 
     14    <p> 
     15      <label for="id_username">Username:</label> 
     16      {% if form.username.errors %} 
     17        <p class="errors">{{ form.username.errors.as_text }}</p> 
     18      {% endif %} 
     19      {{ form.username }} 
     20    </p> 
     21    <p> 
     22      <label for="id_email">Email address:</label> 
     23      {% if form.email.errors %} 
     24        <p class="errors">{{ form.email.errors.as_text }}</p> 
     25      {% endif %} 
     26      {{ form.email }} 
     27    </p> 
     28    <p> 
     29      <label for="id_password1">Password:</label> 
     30      {% if form.password1.errors %} 
     31        <p class="errors">{{ form.password1.errors.as_text }}</p> 
     32      {% endif %} 
     33      {{ form.password1 }} 
     34    </p> 
     35    <p> 
     36      <label for="id_password2">Password (type again to catch typos):</label> 
     37      {% if form.password2.errors %} 
     38        <p class="errors">{{ form.password2.errors.as_text }}</p> 
     39      {% endif %} 
     40      {{ form.password2 }} 
     41    </p> 
     42    <p class="submit"><input type="submit" value="Register &rarr;"></p> 
    5743  </form> 
    5844   
  • djangoproject.com/django_website/urls.py

    r7895 r9073  
     1from django.conf import settings 
    12from django.conf.urls.defaults import * 
    2 from django.contrib.comments.feeds import LatestFreeCommentsFeed 
    3 from django.contrib.comments.models import FreeComment 
     3from django.contrib import admin 
     4from django.contrib.comments.feeds import LatestCommentFeed 
     5from django.contrib.comments.models import Comment 
    46from django.contrib.sitemaps import views as sitemap_views 
    57from django_website.apps.aggregator.feeds import CommunityAggregatorFeed 
     
    1012 
    1113comments_info_dict = { 
    12     'queryset': FreeComment.objects.filter(is_public=True), 
     14    'queryset': Comment.objects.filter(is_public=True).order_by('-submit_date'), 
    1315    'paginate_by': 15, 
    1416} 
     
    2123feeds = { 
    2224    'weblog': WeblogEntryFeed, 
    23     'comments': LatestFreeCommentsFeed, 
     25    'comments': LatestCommentFeed, 
    2426    'community': CommunityAggregatorFeed, 
    2527} 
     
    3133 
    3234urlpatterns = patterns('', 
    33     (r'freenode\.9xJY7YIUWtwn\.html', 'django.views.generic.simple.direct_to_template', {'template': 'freenode_tmp.html'}), 
     35    (r'^$', 'django.views.generic.simple.direct_to_template', {'template': 'homepage.html'}), 
    3436    (r'^accounts/', include('django_website.apps.accounts.urls')), 
    35     (r'^admin/', include('django.contrib.admin.urls')), 
     37    (r'^admin/(.*)', admin.site.root), 
    3638    (r'^comments/$', 'django.views.generic.list_detail.object_list', comments_info_dict), 
    37     (r'^comments/', include('django.contrib.comments.urls.comments')), 
     39    (r'^comments/', include('django.contrib.comments.urls')), 
    3840    (r'^community/$', 'django.views.generic.list_detail.object_list', aggregator_info_dict), 
    3941    (r'^contact/', include('django_website.apps.contact.urls')), 
     
    4345    (r'^sitemap.xml$', cache_page(sitemap_views.sitemap, 60 * 60 * 6), {'sitemaps': sitemaps}), 
    4446    (r'^weblog/', include('django_website.apps.blog.urls')), 
     47    (r'^freenode\.9xJY7YIUWtwn\.html$', 'django.views.generic.simple.direct_to_template', {'template': 'freenode_tmp.html'}), 
    4548    (r'', include('django.contrib.flatpages.urls')), 
    4649) 
     50 
     51admin.autodiscover()