Permalink
Browse files

added 'code' files

  • Loading branch information...
Balu-Varanasi committed Apr 30, 2012
1 parent 96cd90f commit bcdbbd089ef147c55f987addea4166e31a5cde33
Showing with 842 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +15 −0 src/source/code/activate_21404bb.html
  3. +14 −0 src/source/code/activation_complete_21404bb.html
  4. +14 −0 src/source/code/activation_complete_87106ee.html
  5. +32 −0 src/source/code/activation_email_21404bb.txt
  6. +27 −0 src/source/code/activation_email_subject_3a0af03.txt
  7. +11 −0 src/source/code/add_post_394382.html
  8. +35 −0 src/source/code/article_detail_5db3e5f.html
  9. +15 −0 src/source/code/article_form_39527ee.html
  10. +17 −0 src/source/code/article_list_39527ee.html
  11. +19 −0 src/source/code/base_e887a3e.html
  12. +37 −0 src/source/code/blog_post_394382.html
  13. +28 −0 src/source/code/edit_list_39527ee.html
  14. +10 −0 src/source/code/email_3a0af03.txt
  15. +14 −0 src/source/code/forms_1d155f.py
  16. +34 −0 src/source/code/login_394382.html
  17. +53 −0 src/source/code/models_5db3e5f.py
  18. +14 −0 src/source/code/models_a9ffd8.py
  19. +18 −0 src/source/code/models_c0c759.py
  20. +40 −0 src/source/code/models_c95309.py
  21. +7 −0 src/source/code/paste_confirm_delete_17c506.html
  22. +47 −0 src/source/code/paste_detail_17c506.html
  23. +24 −0 src/source/code/paste_detail_c5f0c2.html
  24. +27 −0 src/source/code/paste_list_17c506.html
  25. +12 −0 src/source/code/paste_list_dee14b.html
  26. +10 −0 src/source/code/post_archive_month_087f567.html
  27. +10 −0 src/source/code/post_archive_week_087f567.html
  28. +15 −0 src/source/code/registration_complete_21404bb.html
  29. +27 −0 src/source/code/registration_form_3a0af03.html
  30. +29 −0 src/source/code/urls_087f567.py
  31. +13 −0 src/source/code/urls_17c506.py
  32. +20 −0 src/source/code/urls_2bb5e33.py
  33. +9 −0 src/source/code/urls_5013af.py
  34. +28 −0 src/source/code/urls_5db3e5f.py
  35. +20 −0 src/source/code/urls_693145.py
  36. +8 −0 src/source/code/urls_749380.py
  37. +10 −0 src/source/code/urls_dee14b.py
  38. +42 −0 src/source/code/views_134bb6.py
  39. +36 −0 src/source/code/views_abd13c.py
View
@@ -5,3 +5,4 @@
*.db
*local_settings.py
*build/*
+src/build/doctrees/*
@@ -0,0 +1,15 @@
+{% extends "registration/base.html" %}
+
+{% comment %}
+**registration/activate.html**
+
+Used if account activation fails. With the default setup, has the following context:
+
+``activation_key``
+ The activation key used during the activation attempt.
+{% endcomment %}
+
+{% block content %}
+Sorry, your account could not be activated at this time.
+{% endblock %}
+
@@ -0,0 +1,14 @@
+{% extends "registration/base.html" %}
+
+{% comment %}
+**registration/activation_complete.html**
+
+Used after successful account activation. This template has no context
+variables of its own, and should simply inform the user that their
+account is now active.
+{% endcomment %}
+
+{% block content %}
+Thanks! Your account has be activated. Please <a href="{% url auth_login %}">login to continue</a>
+{% endblock %}
+
@@ -0,0 +1,14 @@
+{% extends "registration/base.html" %}
+
+{% comment %}
+**registration/activation_complete.html**
+
+Used after successful account activation. This template has no context
+variables of its own, and should simply inform the user that their
+account is now active.
+{% endcomment %}
+
+{% block content %}
+Thanks! Your account has be activated. Please <a href="{% url auth_login %}?next={% url wiki_article_index %}">login to continue</a>
+{% endblock %}
+
@@ -0,0 +1,32 @@
+{% extends "registration/email.txt" %}
+
+{% comment %}
+**registration/activation_email.txt**
+
+Used to generate the body of the activation email. Should display a
+link the user can click to activate the account. This template has the
+following context:
+
+``activation_key``
+ The activation key for the new account.
+
+``expiration_days``
+ The number of days remaining during which the account may be
+ activated.
+
+``site``
+ An object representing the site on which the user registered;
+ depending on whether ``django.contrib.sites`` is installed, this
+ may be an instance of either ``django.contrib.sites.models.Site``
+ (if the sites application is installed) or
+ ``django.contrib.sites.models.RequestSite`` (if not). Consult `the
+ documentation for the Django sites framework
+ <http://docs.djangoproject.com/en/dev/ref/contrib/sites/>`_ for
+ details regarding these objects' interfaces.
+{% endcomment %}
+
+{% block body %}
+Please follow the link to activate your account.
+
+http://{{ site }}{% url registration_activate activation_key %}
+{% endblock %}
@@ -0,0 +1,27 @@
+{% comment %}
+**registration/activation_email_subject.txt**
+
+Used to generate the subject line of the activation email. Because the
+subject line of an email must be a single line of text, any output
+from this template will be forcibly condensed to a single line before
+being used. This template has the following context:
+
+``activation_key``
+ The activation key for the new account.
+
+``expiration_days``
+ The number of days remaining during which the account may be
+ activated.
+
+``site``
+ An object representing the site on which the user registered;
+ depending on whether ``django.contrib.sites`` is installed, this
+ may be an instance of either ``django.contrib.sites.models.Site``
+ (if the sites application is installed) or
+ ``django.contrib.sites.models.RequestSite`` (if not). Consult `the
+ documentation for the Django sites framework
+ <http://docs.djangoproject.com/en/dev/ref/contrib/sites/>`_ for
+ details regarding these objects' interfaces.
+{% endcomment %}
+
+Your account activation details at {{ site }}
@@ -0,0 +1,11 @@
+<h2>Hello {{ user.username }}</h2>
+<br />
+<h2>Add new post</h2>
+<form action="" method="POST">
+ {% csrf_token %}
+ <table>
+ {{ form.as_table }}
+ </table>
+ <input type="submit" name="add" value="Add" />
+</form>
+
@@ -0,0 +1,35 @@
+{% load markup %}
+
+{% if messages %}
+ <div class="messages">
+ <ul>
+ {% for message in messages %}
+ <li class="{{ message.tag }}">
+ {{ message }}
+ </li>
+ {% endfor %}
+ </ul>
+ </div>
+{% endif %}
+
+{% if not object.is_published %}
+ <label>Note: This article has not been published yet</label>
+{% endif %}
+
+<h2>{{ object.title }}</h2>
+
+<p>
+{{ object.text|restructuredtext }}
+</p>
+
+<h3>Actions<h3>
+<ul>
+ <li>
+ <a href="{% url wiki_article_edit object.slug %}">Edit this article</a>
+ </li>
+ <li>
+ <a href="{% url wiki_article_history object.slug %}">View article history</a>
+ </li>
+</ul>
+
+<a href="{% url wiki_article_index %}">See All</a>
@@ -0,0 +1,15 @@
+{% if article %}
+ <h1>Edit article {{ article }}</h1>
+{% else %}
+ <h1>Create new article</h1>
+{% endif %}
+
+<form action="" method="POST">
+ {% csrf_token %}
+ <table>
+ {{ form.as_table }}
+ {{ edit_form.as_table }}
+ </table>
+ <input type="submit" name="submit" value="Submit">
+</form>
+
@@ -0,0 +1,17 @@
+{% if object_list %}
+
+<h2>Recent Articles</h2>
+
+<ul>
+ {% for article in object_list %}
+ <li>
+ <a href="{% url wiki_article_detail article.slug %}">{{ article.title }}</a>
+ </li>
+ {% endfor %}
+</ul>
+
+{% else %}
+<h2>No articles have been published yet.</h2>
+{% endif %}
+
+<a href="{% url wiki_article_add %}">Create new article</a>
@@ -0,0 +1,19 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8">
+ <title>Wiki</title>
+ {% block extra_head %}
+
+ {% endblock %}
+ </head>
+ <body>
+ <div class="content">
+ <p>
+ {% block content %}
+ {% endblock %}
+ </p>
+ </div>
+ </body>
+</html>
+
@@ -0,0 +1,37 @@
+<h2>{{ post.title }}</h2>
+
+<div class="content">
+ <p>
+ {{ post.text }}
+ </p>
+ <span>
+ Written by {{ post.author }} on {{ post.created_on }}
+ </span>
+</div>
+
+{% if post.comment_set.all %}
+<h2>Comments</h2>
+<div class="comments">
+ {% for comment in post.comment_set.all %}
+ <span>
+ <a href="{{ comment.website }}">{{ comment.name }}</a> said on {{ comment.created_on }}
+ </span>
+ <p>
+ {{ comment.text }}
+ </p>
+ {% endfor %}
+</div>
+{% endif %}
+
+<br />
+
+<h2>Add Comment</h2>
+
+<form action="" method="POST">
+ {% csrf_token %}
+ <table>
+ {{ form.as_table }}
+ </table>
+ <input type="submit" name="submit" value="Submit" />
+</form>
+
@@ -0,0 +1,28 @@
+<h2>History</h2>
+
+<h3>{{ article }}</h3>
+
+<table border="1" cellspacing="0">
+ <thead>
+ <th>Edited</th>
+ <th>User</th>
+ <th>Summary</th>
+ </thead>
+ <tbody>
+ {% for edit in object_list %}
+ <tr>
+ <td>{{ edit.edited_on }}</td>
+ <td>{{ edit.editor }}</td>
+ <td>{{ edit.summary }}</td>
+ </tr>
+ {% endfor %}
+ <tr>
+ <td>{{ article.created_on }}</td>
+ <td>{{ article.author }}</td>
+ <td>New article created</td>
+ </tr>
+ </tbody>
+</table>
+
+<br />
+<a href="{% url wiki_article_detail article.slug %}"><< Back</a>
@@ -0,0 +1,10 @@
+Hi!,
+
+{% block body %}
+{% endblock %}
+
+Regards,
+Admin
+
+Note: This is an autogenerated mail, please don't reply.
+
@@ -0,0 +1,14 @@
+from django import forms
+
+from models import Post, Comment
+
+class PostForm(forms.ModelForm):
+ class Meta:
+ model = Post
+ exclude = ['author', 'slug']
+
+class CommentForm(forms.ModelForm):
+ class Meta:
+ model = Comment
+ exclude = ['post']
+
@@ -0,0 +1,34 @@
+{% extends "admin/base_site.html" %}
+{% load i18n %}
+
+{% block extrastyle %}{% load adminmedia %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/login.css" />{% endblock %}
+
+{% block bodyclass %}login{% endblock %}
+
+{% block content_title %}{% endblock %}
+
+{% block breadcrumbs %}{% endblock %}
+
+{% block content %}
+{% if error_message %}
+<p class="errornote">{{ error_message }}</p>
+{% endif %}
+<div id="content-main">
+<form action="{{ app_path }}" method="post" id="login-form">{% csrf_token %}
+ <div class="form-row">
+ <label for="id_username">{% trans 'Username:' %}</label> <input type="text" name="username" id="id_username" />
+ </div>
+ <div class="form-row">
+ <label for="id_password">{% trans 'Password:' %}</label> <input type="password" name="password" id="id_password" />
+ <input type="hidden" name="this_is_the_login_form" value="1" />
+ </div>
+ <div class="submit-row">
+ <label>&nbsp;</label><input type="submit" value="{% trans 'Log in' %}" />
+ </div>
+</form>
+
+<script type="text/javascript">
+document.getElementById('id_username').focus()
+</script>
+</div>
+{% endblock %}
@@ -0,0 +1,53 @@
+from django.db import models
+from django.contrib.auth.models import User
+from django.template.defaultfilters import slugify
+
+# Create your models here.
+
+class PublishedArticlesManager(models.Manager):
+
+ def get_query_set(self):
+ return super(PublishedArticlesManager, self).get_query_set().filter(is_published=True)
+
+class Article(models.Model):
+ """Represents a wiki article"""
+
+ title = models.CharField(max_length=100)
+ slug = models.SlugField(max_length=50, unique=True)
+ text = models.TextField(help_text="Formatted using ReST")
+ author = models.ForeignKey(User)
+ is_published = models.BooleanField(default=False, verbose_name="Publish?")
+ created_on = models.DateTimeField(auto_now_add=True)
+ objects = models.Manager()
+ published = PublishedArticlesManager()
+
+ def __unicode__(self):
+ return self.title
+
+ def save(self, *args, **kwargs):
+ if not self.slug:
+ self.slug = slugify(self.title)
+ super(Article, self).save(*args, **kwargs)
+
+ @models.permalink
+ def get_absolute_url(self):
+ return ('wiki_article_detail', (), { 'slug': self.slug })
+
+class Edit(models.Model):
+ """Stores an edit session"""
+
+ article = models.ForeignKey(Article)
+ editor = models.ForeignKey(User)
+ edited_on = models.DateTimeField(auto_now_add=True)
+ summary = models.CharField(max_length=100)
+
+ class Meta:
+ ordering = ['-edited_on']
+
+ def __unicode__(self):
+ return "%s - %s - %s" %(self.summary, self.editor, self.edited_on)
+
+ @models.permalink
+ def get_absolute_url(self):
+ return ('wiki_edit_detail', self.id)
+
Oops, something went wrong.

0 comments on commit bcdbbd0

Please sign in to comment.