damned-lies r1098 - in branches/djamnedlies: . stats templates templates/stats



Author: stephaner
Date: Sun Oct 26 02:03:25 2008
New Revision: 1098
URL: http://svn.gnome.org/viewvc/damned-lies?rev=1098&view=rev

Log:
2008-10-26  StÃphane Raimbault  <stephane raimbault gmail com>

	* README: Added note about Sites setting.
	* TODO: Added item to use username instead of person_id.
	* stats/models.py: Defined get_absolute_url for Person. Explicit
	relation name between coordinator and person to not mix up with
	'groups'.	
	* stats/urls.py: Use a generic view for person.
	* stats/views.py: Remove the deprecated view.
	* templates/person-base.html: Use get_absolute_url
	* templates/person.html: Renamed in person_detail.html
	* templates/stats/person_detail.html: Use object instead of person
	and add an ugly hack to use person into the included template.


Added:
   branches/djamnedlies/templates/stats/
   branches/djamnedlies/templates/stats/person_detail.html
Removed:
   branches/djamnedlies/templates/person.html
Modified:
   branches/djamnedlies/ChangeLog
   branches/djamnedlies/README
   branches/djamnedlies/TODO
   branches/djamnedlies/stats/models.py
   branches/djamnedlies/stats/urls.py
   branches/djamnedlies/stats/views.py
   branches/djamnedlies/templates/person-base.html

Modified: branches/djamnedlies/README
==============================================================================
--- branches/djamnedlies/README	(original)
+++ branches/djamnedlies/README	Sun Oct 26 02:03:25 2008
@@ -16,3 +16,6 @@
 
 1 - Rename settings_sample.py in settings.py
 2 - Review and fill in settings in stats/conf/settings.py 
+3 - python manage.py syncdb
+4 - Configure Sites in admin interface to define the 'View on site'
+    link.

Modified: branches/djamnedlies/TODO
==============================================================================
--- branches/djamnedlies/TODO	(original)
+++ branches/djamnedlies/TODO	Sun Oct 26 02:03:25 2008
@@ -1,3 +1,5 @@
 Things left to do:
  * i18n (translation for strings in database?)
  * replace entirely defaults.py by conf/settings.py
+ * we could use username instead of person_id (get_absolute_url must
+   be updated accordingly) in urls.py

Modified: branches/djamnedlies/stats/models.py
==============================================================================
--- branches/djamnedlies/stats/models.py	(original)
+++ branches/djamnedlies/stats/models.py	Sun Oct 26 02:03:25 2008
@@ -54,12 +54,18 @@
     def name(self):
         return self.first_name + " " + self.last_name
 
+    @models.permalink
+    def get_absolute_url(self):
+        return ('person_view', [str(self.id)])
+
+
 class Team(Group):
     """ The name of the team is stored in Group.name.
         The lang_code is generally used. """
 
     description = models.TextField()
-    coordinator = models.ForeignKey('Person')
+    # Don't confuse this relation with the 'groups' one
+    coordinator = models.ForeignKey('Person', related_name='managed_teams')
     webpage_url = models.URLField(null=True)
     mailing_list = models.URLField(null=True)
     mailing_list_subscribe = models.URLField(null=True)
@@ -76,6 +82,7 @@
     name = models.CharField(max_length=50)
     locale = models.CharField(max_length=15)
     team = models.ForeignKey('Team', null=True)
+
     class Meta:
         db_table = 'language'
         ordering = ('name',)

Modified: branches/djamnedlies/stats/urls.py
==============================================================================
--- branches/djamnedlies/stats/urls.py	(original)
+++ branches/djamnedlies/stats/urls.py	Sun Oct 26 02:03:25 2008
@@ -1,4 +1,5 @@
 from django.conf.urls.defaults import *
+from stats.models import Person
 from stats.conf import settings
 
 # Uncomment the next two lines to enable the admin:
@@ -13,13 +14,21 @@
     (r'^languages/(?P<name>\w+)/$', 'team'),
     (r'^languages/(?P<langcode>\w+)/(?P<release_id>\d+)/$', 'languagerelease'),
     (r'^people/*$', 'people'),
-    (r'^people/(?P<person_id>.*)$', 'person'),
     (r'^module/*$', 'modules'),
     (r'^module/(?P<module_name>[^/]+)$', 'module'),
     (r'^module/(?P<module_name>\w+)/(?P<potbase>\w+)/(?P<branch_name>\w+)/(?P<langcode>\w+)/images/$', 'docimages'),
     (r'^releases/*$', 'releases'),
     (r'^releases/(?P<release_id>.*)$', 'release'),
 )
+
+people_dict = {
+    'queryset': Person.objects.all(),
+}
+urlpatterns += patterns('django.views.generic',
+    url(r'^people/(?P<object_id>\d+)/$', 'list_detail.object_detail',
+        dict(people_dict), 'person_view'),
+)
+
     # Static files (should be replaced by web server redirection in production
 urlpatterns += patterns('',
     (r'^POT/(?P<path>.*)$', 'django.views.static.serve',

Modified: branches/djamnedlies/stats/views.py
==============================================================================
--- branches/djamnedlies/stats/views.py	(original)
+++ branches/djamnedlies/stats/views.py	Sun Oct 26 02:03:25 2008
@@ -77,18 +77,6 @@
                'webroot': settings.WEBROOT }
     return render_to_response('people.html', context)
 
-def person(request, person_id):
-    """ Print the details of a single person """
-    person = Person.objects.get(id=person_id)
-    maintainer = person.module_set.all()
-    translator = Team.objects.filter(coordinator=person_id)
-    context = {'pageSection':  "teams",
-               'person': person,
-               'printroles': True,
-               'roles': {'maintains':maintainer, 'translates':translator}, 
-               'webroot': settings.WEBROOT }
-    return render_to_response('person.html', context)
-
 def modules(request):
     all_modules = Module.objects.all()
     context = {'pageSection':  "module",

Modified: branches/djamnedlies/templates/person-base.html
==============================================================================
--- branches/djamnedlies/templates/person-base.html	(original)
+++ branches/djamnedlies/templates/person-base.html	Sun Oct 26 02:03:25 2008
@@ -11,7 +11,7 @@
     <img class="people" src="/media/img/nobody.png" alt="" />
   {% endif %}
 
-  <a style="font-size: 140%;" href="{{ webroot }}/people/{{ person.id }}">{{ person.name }}</a><br />
+  <a style="font-size: 140%;" href="{{ person.get_absolute_url }}">{{ person.name }}</a><br />
 
   {% if person.nospamemail %}
     <a href="mailto:{{ person.nospamemail }}">{{ person.nospamemail }}</a><br />

Added: branches/djamnedlies/templates/stats/person_detail.html
==============================================================================
--- (empty file)
+++ branches/djamnedlies/templates/stats/person_detail.html	Sun Oct 26 02:03:25 2008
@@ -0,0 +1,18 @@
+{% extends "base.html" %}
+{% load i18n %}
+
+{% block title %} {% trans "GNOME Contributor" %} {% endblock %}
+
+{% block content %}
+<div class="mainpage">
+
+  <h2>{{ object.name}}</h2>
+  {% with 1 as printroles %}
+  {% with object as person %}
+  {% include "person-base.html" %}
+  {% endwith %}
+  {% endwith %}
+
+</div>
+
+{% endblock %}



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