Author: jacob
Date: 2008-07-11 13:06:48 -0500 (Fri, 11 Jul 2008)
New Revision: 7895

Added:
   djangoproject.com/django_website/apps/contact/
   djangoproject.com/django_website/apps/contact/__init__.py
   djangoproject.com/django_website/apps/contact/forms.py
   djangoproject.com/django_website/apps/contact/urls.py
   djangoproject.com/django_website/templates/base_foundation.html
   djangoproject.com/django_website/templates/contact/
   djangoproject.com/django_website/templates/contact/foundation.html
   djangoproject.com/django_website/templates/contact/sent.html
Modified:
   djangoproject.com/django_website/apps/docs/views.py
   djangoproject.com/django_website/settings.py
   djangoproject.com/django_website/templates/flatpages/foundation.html
   djangoproject.com/django_website/urls.py
Log:
[djangoproject.com] Added a foundation contact form.

Added: djangoproject.com/django_website/apps/contact/__init__.py
===================================================================

Added: djangoproject.com/django_website/apps/contact/forms.py
===================================================================
--- djangoproject.com/django_website/apps/contact/forms.py                      
        (rev 0)
+++ djangoproject.com/django_website/apps/contact/forms.py      2008-07-11 
18:06:48 UTC (rev 7895)
@@ -0,0 +1,17 @@
+import textwrap
+from django import newforms as forms
+from contact_form.forms import AkismetContactForm
+
+attrs = {'class': 'required'}
+
+class BaseContactForm(AkismetContactForm):
+    message_subject = forms.CharField(max_length=100, 
widget=forms.TextInput(attrs=attrs), label=u'Message subject')
+
+    def subject(self):
+        return "[Contact form] " + self.cleaned_data["message_subject"]
+
+    def message(self):
+        return textwrap.wrap(self.cleaned_data["body"], 76)
+
+class FoundationContactForm(BaseContactForm):
+    pass
\ No newline at end of file

Added: djangoproject.com/django_website/apps/contact/urls.py
===================================================================
--- djangoproject.com/django_website/apps/contact/urls.py                       
        (rev 0)
+++ djangoproject.com/django_website/apps/contact/urls.py       2008-07-11 
18:06:48 UTC (rev 7895)
@@ -0,0 +1,24 @@
+from django.conf.urls.defaults import *
+from django.views.generic.simple import direct_to_template
+from contact_form.views import contact_form
+from django_website.apps.contact.forms import FoundationContactForm
+
+urlpatterns = patterns('',
+    url(
+        regex = r'^foundation/$',
+        view  = contact_form,
+        kwargs = dict(
+            form_class = FoundationContactForm,
+            template_name = 'contact/foundation.html',
+        ),
+        name = 'contact_foundation',
+    ),
+    url(
+        regex = r'^sent/',
+        view  = direct_to_template,
+        kwargs = dict(
+            template = 'contact/sent.html',
+        ),
+        name = 'contact_sent',
+    )
+)
\ No newline at end of file

Modified: djangoproject.com/django_website/apps/docs/views.py
===================================================================
--- djangoproject.com/django_website/apps/docs/views.py 2008-07-11 15:38:00 UTC 
(rev 7894)
+++ djangoproject.com/django_website/apps/docs/views.py 2008-07-11 18:06:48 UTC 
(rev 7895)
@@ -11,9 +11,11 @@
 from django_website.apps.docs import builder
 import pysvn
 
+REVISION = pysvn.Revision(pysvn.opt_revision_kind.head)
+
 def doc_index(request, version=None):
     client, version, docroot = _get_svnroot(version, "docs/")
-    doclist = client.ls(docroot, recurse=False)
+    doclist = client.ls(docroot, recurse=False, revision=REVISION)
     
     # Convert list of URLs to list of document slugs.
     doclist = [os.path.splitext(os.path.basename(doc.name))[0] for doc in 
doclist]
@@ -30,14 +32,14 @@
 
     docpath = urlparse.urljoin(docroot, slug+".txt")
     try:
-        name, info = client.info2(docpath)[0]
+        name, info = client.info2(docpath, revision=REVISION)[0]
     except pysvn.ClientError:
         raise Http404("Invalid doc: %r (version %r)" % (slug, version))
         
     cache_key = "djangowebsite:docs:%s:%s:%s" % (version, slug, 
info.rev.number)
     parts = cache.get(cache_key)
     if parts is None:
-        parts = builder.build_document(client.cat(docpath))
+        parts = builder.build_document(client.cat(docpath, revision=REVISION))
         cache.set(cache_key, parts, 60*60)
     
     template_list = ["docs/%s_detail.html" % version, "docs/detail.html"]
@@ -57,9 +59,9 @@
     cache_key = "djangowebsite:docs:modelindex:%s" % version
     model_docs = cache.get(cache_key, [])
     if not model_docs:
-        for testdir in client.ls(testroot):
+        for testdir in client.ls(testroot, revision=REVISION):
             try:
-                content = client.cat(os.path.join(testdir.name, "models.py"))
+                content = client.cat(os.path.join(testdir.name, "models.py"), 
revision=REVISION)
             except pysvn.ClientError:
                 continue
 
@@ -87,12 +89,12 @@
     
 def model_detail(request, slug, version=None):
     client, version, modelfile = _get_svnroot(version, 
"tests/modeltests/%s/models.py" % slug)
-    name, info = client.info2(modelfile)[0]
+    name, info = client.info2(modelfile, revision=REVISION)[0]
     
     cache_key = "djangowebsite:docs:model:%s:%s:%s" % (version, slug, 
info.rev.number)
     parts = cache.get(cache_key)
     if parts is None:
-        parts = builder.build_model_document(client.cat(modelfile))
+        parts = builder.build_model_document(client.cat(modelfile, 
revision=REVISION))
         cache.set(cache_key, parts, 60*60)
         
     return render_to_response(
@@ -112,7 +114,7 @@
     docroot = urlparse.urljoin(settings.DJANGO_SVN_ROOT, subpath)
 
     try:
-        client.info2(docroot, recurse=False)
+        client.info2(docroot, recurse=False, revision=REVISION)
     except pysvn.ClientError:
         raise Http404("Bad SVN path: %s" % docroot)
         

Modified: djangoproject.com/django_website/settings.py
===================================================================
--- djangoproject.com/django_website/settings.py        2008-07-11 15:38:00 UTC 
(rev 7894)
+++ djangoproject.com/django_website/settings.py        2008-07-11 18:06:48 UTC 
(rev 7895)
@@ -3,7 +3,7 @@
 # Far too clever trick to know if we're running on the deployment server.
 DEVELOPMENT_MODE = (platform.node() != "djangoproject")
 
-ADMINS = (('Adrian Holovaty','[EMAIL PROTECTED]'), ('Jacob Kaplan-Moss', 
'[EMAIL PROTECTED]'))
+ADMINS = (('Adrian Holovaty','[EMAIL PROTECTED]'), ('Jacob Kaplan-Moss', 
'[EMAIL PROTECTED]'))
 TIME_ZONE = 'America/Chicago'
 
 SERVER_EMAIL = '[EMAIL PROTECTED]'
@@ -16,7 +16,7 @@
 if DEVELOPMENT_MODE:
     DEBUG = True
     PREPEND_WWW = False
-    CACHE_BACKEND = "file:///tmp/djangoprojectcache/"
+    CACHE_BACKEND = "dummy:///"
     DJANGO_SVN_ROOT = "http://code.djangoproject.com/svn/django/";
 else:
     DEBUG = False

Added: djangoproject.com/django_website/templates/base_foundation.html
===================================================================
--- djangoproject.com/django_website/templates/base_foundation.html             
                (rev 0)
+++ djangoproject.com/django_website/templates/base_foundation.html     
2008-07-11 18:06:48 UTC (rev 7895)
@@ -0,0 +1,45 @@
+{% extends "base_community.html" %}
+
+{% block content-related %}
+<h2>Support Django</h2>
+<script type="text/javascript"> 
+function validateAmount(amount){
+       if(amount.value.match( /^[0-9]+(\.([0-9]+))?$/)){
+               return true;
+       }else{
+               alert('You must enter a valid donation.');
+               amount.focus();
+               return false;
+       }
+}
+</script>
+<form 
action="https://checkout.google.com/cws/v2/Donations/404630304217012/checkoutForm";
 id="BB_BuyButtonForm" method="post" name="BB_BuyButtonForm" onSubmit="return 
validateAmount(this.item_price_1)">
+    <input name="item_name_1" type="hidden" value="Support the Django Software 
Foundation!"/>
+    <input name="item_description_1" type="hidden" value="Thanks for your 
help! Your money will directly support the development of Django by sponsoring 
developer meetings, user conferences, and other community activities."/>
+    <input name="item_quantity_1" type="hidden" value="1"/>
+    <input name="item_currency_1" type="hidden" value="USD"/>
+    <input name="item_is_modifiable_1" type="hidden" value="true"/>
+    <input name="item_min_price_1" type="hidden" value="0.0"/>
+    <input name="item_max_price_1" type="hidden" value="25000.0"/>
+    <input name="_charset_" type="hidden" value="utf-8"/>
+    <input id="item_price_1" name="item_price_1" 
onfocus="this.style.color='black'; this.value='';" size="6" type="text" 
value="20.00"/>
+    <input type="submit" name="submit" value="Donate" id="submit">
+</form>
+
+<h3>Questions?</h3>
+<p>Read more about <a href="/foundation/donate/">donating to the DSF</a>.
+  
+<h2>Licensing &amp; Trademarks</h2>  
+<ul>
+  <li>Django licensing policies</li>
+  <li>Contributor license agreements</li>
+</ul>
+
+<h2>About the foundation</h2>
+<ul>
+  <li>FAQ</li>
+  <li>Records</li>
+  <li>Board meeting minutes</li>
+  <li>Board resolutions</li>
+</ul>
+{% endblock %}

Added: djangoproject.com/django_website/templates/contact/foundation.html
===================================================================
--- djangoproject.com/django_website/templates/contact/foundation.html          
                (rev 0)
+++ djangoproject.com/django_website/templates/contact/foundation.html  
2008-07-11 18:06:48 UTC (rev 7895)
@@ -0,0 +1,45 @@
+{% extends "base_foundation.html" %}
+
+{% block title %}Contact the Django Software Foundation{% endblock %}
+
+{% block extrahead %}
+  {{ block.super }}
+  <style type="text/css" media="screen">
+    form.contact label { display: block; font-weight: bold; margin-top: 1.5em; 
margin-bottom: 0;}
+    form.contact label span { font-weight: normal; color: #555; }
+    form.contact input, 
+    form.contact textarea, 
+    form.contact select { width: 99%; padding: 1px; }
+    form.contact p { margin: 0; }
+    form.contact p.submit { text-align: right; margin-top: 1em; margin-right: 
0;}
+    form.contact p.submit input { width: 10em; font-size: 1.5em; }
+    form.contact p.errors { margin: 0; padding: 0; font-weight: bold; color: 
red; }
+  </style>
+{% endblock %}
+
+{% block content %}
+<h1>Contact the Django Software Foundation</h1>
+<form action="." method="post" accept-charset="utf-8" class="contact">
+  <p>
+    <label for="id_name">Your name:</label>
+    {% if form.name.errors %}<p class="errors">{{ form.name.errors.as_text 
}}</p>{% endif %}
+    {{ form.name }}
+  </p>
+  <p>
+    <label for="id_email">Your email address:</label>
+    {% if form.email.errors %}<p class="errors">{{ form.email.errors.as_text 
}}</p>{% endif %}
+    {{ form.email }}
+  </p>
+  <p>
+    <label for="id_message_subject">Message subject:</label>
+    {% if form.message_subject.errors %}<p class="errors">{{ 
form.message_subject.errors.as_text }}</p>{% endif %}
+    {{ form.message_subject }}
+  </p>
+  <p>
+    <label for="id_body">Your message:</label>
+    {% if form.body.errors %}<p class="errors">{{ form.body.errors.as_text 
}}</p>{% endif %}
+    {{ form.body }}
+  </p>
+  <p class="submit"><input type="submit" value="Send &rarr;"></p>
+</form>
+{% endblock %}
\ No newline at end of file

Added: djangoproject.com/django_website/templates/contact/sent.html
===================================================================
--- djangoproject.com/django_website/templates/contact/sent.html                
                (rev 0)
+++ djangoproject.com/django_website/templates/contact/sent.html        
2008-07-11 18:06:48 UTC (rev 7895)
@@ -0,0 +1,18 @@
+{% extends "base.html" %}
+
+{% block title %}Message sent{% endblock %}
+
+{% block content %}
+  <h1>Message sent</h1>
+  <h2 class="deck">Your message has been sent; thanks!</h2>
+  <p>
+    Your mail <em>will</em> be read by a real, live human being. We can't
+    guarantee when or whether you'll get a reply, but your message
+    <em>will</em> be read, generally within the next couple of days.
+  </p>
+  <p>
+    If you're expecting a reply and don't get one, please feel free
+    to send a reminder. Please wait a few days, however, unless
+    it's an emergency.
+  </p>
+{% endblock %}
\ No newline at end of file

Modified: djangoproject.com/django_website/templates/flatpages/foundation.html
===================================================================
--- djangoproject.com/django_website/templates/flatpages/foundation.html        
2008-07-11 15:38:00 UTC (rev 7894)
+++ djangoproject.com/django_website/templates/flatpages/foundation.html        
2008-07-11 18:06:48 UTC (rev 7895)
@@ -1,10 +1,22 @@
-{% extends "base_community.html" %}
+{% extends "base_foundation.html" %}
 
-{% block title %}Foundation{% endblock %}
+{% block extrahead %}
+<style type="text/css" media="screen">
+  form #submit { 
+      border: 0px none; 
+      background-color: transparent;
+      color: transparent;
+      background-image: 
url(https://checkout.google.com/buttons/donateNow.gif?merchant_id=404630304217012&w=115&h=50&style=trans&variant=text&loc=en_US);
+      background-position: 0px 3px;
+      width: 115px;
+      height: 35px;
+  }
+</style>
+{% endblock %}
 
+{% block title %}{{ flatpage.title }}{% endblock %}
+
 {% block content %}
 <h1>{{ flatpage.title }}</h1>
 {{ flatpage.content }}
-{% endblock %}
-
-{% block content-related %}{% endblock %}
+{% endblock %}
\ No newline at end of file

Modified: djangoproject.com/django_website/urls.py
===================================================================
--- djangoproject.com/django_website/urls.py    2008-07-11 15:38:00 UTC (rev 
7894)
+++ djangoproject.com/django_website/urls.py    2008-07-11 18:06:48 UTC (rev 
7895)
@@ -36,6 +36,7 @@
     (r'^comments/$', 'django.views.generic.list_detail.object_list', 
comments_info_dict),
     (r'^comments/', include('django.contrib.comments.urls.comments')),
     (r'^community/$', 'django.views.generic.list_detail.object_list', 
aggregator_info_dict),
+    (r'^contact/', include('django_website.apps.contact.urls')),
     (r'^documentation/', include('django_website.apps.docs.urls')),
     (r'^r/', include('django.conf.urls.shortcut')),
     (r'^rss/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', 
{'feed_dict': feeds}),


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to