savannah-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Savannah-cvs] [SCM] Savane-cleanup framework branch, master, updated. 8


From: Sylvain Beucler
Subject: [Savannah-cvs] [SCM] Savane-cleanup framework branch, master, updated. 813513f78f2a4944320c130ef28ee9560504759b
Date: Sun, 25 Jul 2010 19:16:16 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Savane-cleanup framework".

The branch, master has been updated
       via  813513f78f2a4944320c130ef28ee9560504759b (commit)
      from  49aa3e88609d97cf4b512b937cc57573456d5265 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/savane-cleanup/framework.git/commit/?id=813513f78f2a4944320c130ef28ee9560504759b

commit 813513f78f2a4944320c130ef28ee9560504759b
Author: Sylvain Beucler <address@hidden>
Date:   Sun Jul 25 21:15:58 2010 +0200

    Interface to edit project info

diff --git a/savane/svmain/forms.py b/savane/svmain/forms.py
new file mode 100644
index 0000000..a919814
--- /dev/null
+++ b/savane/svmain/forms.py
@@ -0,0 +1,26 @@
+# Forms for users and groups
+# Copyright (C) 2010  Sylvain Beucler
+#
+# This file is part of Savane.
+# 
+# Savane is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+# 
+# Savane is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+# 
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+
+from django import forms
+import models as svmain_models
+
+class GroupInfoForm(forms.ModelForm):
+    class Meta:
+        model = svmain_models.SvGroupInfo
+        fields = ('full_name', 'short_description', 'long_description', 
'devel_status',)
diff --git a/savane/svmain/models.py b/savane/svmain/models.py
index e12f751..38ae4c5 100644
--- a/savane/svmain/models.py
+++ b/savane/svmain/models.py
@@ -62,6 +62,7 @@ create the extended data on first access.
 
 from django.db import models
 from django.contrib.auth import models as auth_models
+from django.utils.translation import ugettext, ugettext_lazy as _
 
 
 class SshKey(models.Model):
@@ -369,6 +370,7 @@ class SvGroupInfo(models.Model):
 
     class Meta:
         ordering = ['group__name']
+        verbose_name = _("project information")
 
     group = AutoOneToOneField(auth_models.Group, primary_key=True)
 
diff --git a/savane/svmain/templatetags/svtopmenu.py 
b/savane/svmain/templatetags/svtopmenu.py
index 5f0c739..1258e92 100644
--- a/savane/svmain/templatetags/svtopmenu.py
+++ b/savane/svmain/templatetags/svtopmenu.py
@@ -49,6 +49,8 @@ def svtopmenu(context, menu_name):
             entry_home['children'].append({'separator' : True })
             entry_home['children'].append({'text' : _("Administer:"), 
'strong': True,
                                            'href' : 
reverse('savane.svmain.group_admin', args=[group.name]) })
+            entry_home['children'].append({'text' : _("Edit Public Info"),
+                                           'href' : 
reverse('savane.svmain.group_admin_info', args=[group.name]) })
             entry_home['children'].append({'text' : _("Manage Members"),
                                            'href' : 
reverse('savane.svmain.group_admin_members', args=[group.name]) })
 
diff --git a/savane/svmain/urls.py b/savane/svmain/urls.py
index 1aa77d8..01aec5e 100644
--- a/savane/svmain/urls.py
+++ b/savane/svmain/urls.py
@@ -99,6 +99,10 @@ urlpatterns += decorated_patterns ('', only_project_admin,
   url(r'^p/(?P<slug>[-\w]+)/admin/$', views.group_admin,
       { 'extra_context' : { 'title' : 'Administration Summary' }, },
       name='savane.svmain.group_admin'),
+  url(r'^p/(?P<slug>[-\w]+)/admin/members/$', views.group_admin_info,
+      { 'post_save_redirect' : '../../',  # back to project page to see the 
changes
+        'extra_context' : { 'title' : 'Administration Summary: Editing Public 
Info' }, },
+      name='savane.svmain.group_admin_info'),
   url(r'^p/(?P<slug>[-\w]+)/admin/members/$', views.group_admin_members,
       { 'extra_context' : { 'title' : 'Administration Summary: Manage Members' 
}, },
       name='savane.svmain.group_admin_members'),
diff --git a/savane/svmain/views.py b/savane/svmain/views.py
index 5a3c7fc..756019b 100644
--- a/savane/svmain/views.py
+++ b/savane/svmain/views.py
@@ -1,5 +1,5 @@
-# Manage user attributes
-# Copyright (C) 2009  Sylvain Beucler
+# View and manage users and groups
+# Copyright (C) 2009, 2010  Sylvain Beucler
 #
 # This file is part of Savane.
 # 
@@ -21,7 +21,9 @@ from django.shortcuts import render_to_response, 
get_object_or_404
 from django.core.urlresolvers import reverse
 import django.contrib.auth.models as auth_models
 from django.contrib import messages
+from django.utils.text import capfirst
 import models as svmain_models
+import forms as svmain_forms
 from annoying.decorators import render_to
 
 def user_redir(request, slug):
@@ -52,6 +54,33 @@ def group_admin(request, slug, extra_context={}):
     context.update(extra_context)
     return context
 
address@hidden("svmain/group_admin_info.html", mimetype=None)
+def group_admin_info(request, slug, extra_context={}, post_save_redirect=None):
+    group = get_object_or_404(auth_models.Group, name=slug)
+    object = group.svgroupinfo
+
+    form_class = svmain_forms.GroupInfoForm
+
+    if request.method == 'POST': # If the form has been submitted...
+        form = form_class(request.POST, instance=object) # A form bound to the 
POST data
+        if form.is_valid(): # All validation rules pass
+            # Process the data
+            object = form.save()
+            messages.success(request, u"%s saved." % 
capfirst(object._meta.verbose_name))
+            if post_save_redirect is None:
+                post_save_redirect = object.get_absolute_url()
+            return HttpResponseRedirect(post_save_redirect) # Redirect after 
POST
+    else:
+        form = form_class(instance=object) # An unbound form
+
+    print form
+    context = {
+        'group' : group,
+        'form' : form,
+        }
+    context.update(extra_context)
+    return context
+
 @render_to('svmain/group_admin_members.html', mimetype=None)
 def group_admin_members(request, slug, extra_context={}):
     group = get_object_or_404(auth_models.Group, name=slug)
diff --git a/templates/svmain/group_admin_info.html 
b/templates/svmain/group_admin_info.html
new file mode 100644
index 0000000..7714ca1
--- /dev/null
+++ b/templates/svmain/group_admin_info.html
@@ -0,0 +1,37 @@
+{% extends "base.html" %}
+{% load i18n %}
+{% load svtopmenu %}
+
+{% block title %}
+{{group.svgroupinfo.get_full_name_display}} - {{title}}
+{% endblock %}
+
+{% block icon %}preferences{% endblock %}
+
+{% block topmenu %}
+  {% svtopmenu "group" %}
+{% endblock %}
+
+{% block content %}
+
+<form action="." method="POST">{% csrf_token %}
+<input type="hidden" name="next" value="{{next}}" />
+<table>
+{{ form.as_table }}
+<tr>
+  <th>{% trans "License:" %}</th>
+  <td>{% trans "License changes are moderated by the site administrators. 
Please contact them to change your project license." %}</td>
+</tr>
+</table>
+<p><input type="submit" value="{% trans "Submit" %}" /></p>
+</form>
+
+{% endblock %}
+
+{% comment %}
+Local Variables: **
+mode: django-html **
+tab-width: 4 **
+indent-tabs-mode: nil **
+End: **
+{% endcomment %}

-----------------------------------------------------------------------

Summary of changes:
 savane/{context_processors.py => svmain/forms.py} |   18 ++++------
 savane/svmain/models.py                           |    2 +
 savane/svmain/templatetags/svtopmenu.py           |    2 +
 savane/svmain/urls.py                             |    4 ++
 savane/svmain/views.py                            |   33 +++++++++++++++++-
 templates/svmain/group_admin_info.html            |   37 +++++++++++++++++++++
 6 files changed, 84 insertions(+), 12 deletions(-)
 copy savane/{context_processors.py => svmain/forms.py} (66%)
 create mode 100644 templates/svmain/group_admin_info.html


hooks/post-receive
-- 
Savane-cleanup framework



reply via email to

[Prev in Thread] Current Thread [Next in Thread]