Added changelog view under the about main menu

This commit is contained in:
Roberto Rosario
2011-08-06 21:16:36 -04:00
parent f81f480f32
commit 0584244663
4 changed files with 46 additions and 0 deletions

View File

@@ -20,6 +20,12 @@ current_user_edit = {'text': _(u'edit details'), 'view': 'current_user_edit', 'f
register_links(['current_user_details', 'current_user_edit', 'password_change_view'], [current_user_details, current_user_edit, password_change_view], menu_name='secondary_menu')
about = {'text': _('about'), 'view': 'about', 'famfam': 'information'}
changelog = {'text': _('changelog'), 'view': 'changelog', 'famfam': 'book_open'}
register_links(['about', 'changelog'], [about, changelog], menu_name='secondary_menu')
if common_settings.AUTO_CREATE_ADMIN:
# From https://github.com/lambdalisue/django-qwert/blob/master/qwert/autoscript/__init__.py
# From http://stackoverflow.com/questions/1466827/ --

View File

@@ -1,9 +1,12 @@
import os
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.db import models
from django.contrib.auth.models import User
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth import authenticate
from django.conf import settings
from common.utils import return_attrib
from common.widgets import DetailSelectMultiple, PlainWidget, \
@@ -144,3 +147,22 @@ class EmailAuthenticationForm(AuthenticationForm):
# Remove the inherited username field
EmailAuthenticationForm.base_fields.keyOrder = ['email', 'password']
class ChangelogForm(forms.Form):
text = forms.CharField(
label=_(u'Text'),
widget=forms.widgets.Textarea(
attrs={'cols': 40, 'rows': 20, 'readonly': 'readonly'}
)
)
def __init__(self, *args, **kwargs):
super(ChangelogForm, self).__init__(*args, **kwargs)
CHANGELOG_FILENAME = u'Changelog.txt'
CHANGELOG_DIRECTORY = u'docs'
changelog_path = os.path.join(settings.PROJECT_ROOT, CHANGELOG_DIRECTORY, CHANGELOG_FILENAME)
fd = open(changelog_path)
self.fields['text'].initial = fd.read()
fd.close()

View File

@@ -4,6 +4,7 @@ from django.conf import settings
urlpatterns = patterns('common.views',
url(r'^about/$', direct_to_template, {'template': 'about.html'}, 'about'),
url(r'^changelog/$', 'changelog', (), 'changelog'),
#url(r'^password/change/done/$', 'django.contrib.auth.views.password_change_done', {'template_name': 'password_change_done.html'}),
url(r'^password/change/done/$', 'password_change_done', (), name='password_change_done'),
url(r'^object/multiple/action/$', 'multi_object_action_view', (), name='multi_object_action_view'),

View File

@@ -1,3 +1,5 @@
import os
from django.shortcuts import redirect
from django.utils.translation import ugettext_lazy as _
from django.http import HttpResponseRedirect
@@ -8,6 +10,8 @@ from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import reverse
from django.utils.http import urlencode
from django.contrib.auth.views import login
from django.conf import settings
from django.utils.safestring import mark_safe
from common.forms import ChoiceForm, UserForm, UserForm_view
from common.forms import EmailAuthenticationForm
@@ -179,3 +183,16 @@ def login_view(request):
kwargs['authentication_form'] = EmailAuthenticationForm
return login(request, **kwargs)
from common.forms import ChangelogForm
def changelog(request):
#changelog_widget = mark_safe(u'<form class="form"><div class="group"><textarea rows="10" cols="40" class="text_area">%s</textarea></div></form>' % changelog)
form = ChangelogForm()
return render_to_response(
'generic_detail.html', {
'form': form,
'title': _(u'Changelog'),
},
context_instance=RequestContext(request))