damned-lies r1108 - in branches/djamnedlies: . stats
- From: stephaner svn gnome org
- To: svn-commits-list gnome org
- Subject: damned-lies r1108 - in branches/djamnedlies: . stats
- Date: Sun, 26 Oct 2008 20:44:14 +0000 (UTC)
Author: stephaner
Date: Sun Oct 26 20:44:14 2008
New Revision: 1108
URL: http://svn.gnome.org/viewvc/damned-lies?rev=1108&view=rev
Log:
2008-10-26 StÃphane Raimbault <stephane raimbault gmail com>
Missing files in previous commit (2/2)
* TODO: Add some items
* stats/models.py: Add some get_absolute_url. Don't escape release
name with PostgreSQL.
* stats/urls.py: Add explicit names.
* stats/views.py: Remove all webroot except one.
* templates/*.html: Get rid of webroot with url filter or
get_absolute_url. Use the Django convention to name the template
files.
* urls.py: Define the index view.
Modified:
branches/djamnedlies/ChangeLog
branches/djamnedlies/TODO
branches/djamnedlies/stats/models.py
branches/djamnedlies/stats/urls.py
branches/djamnedlies/stats/views.py
branches/djamnedlies/urls.py
Modified: branches/djamnedlies/TODO
==============================================================================
--- branches/djamnedlies/TODO (original)
+++ branches/djamnedlies/TODO Sun Oct 26 20:44:14 2008
@@ -3,3 +3,6 @@
* 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
+ * FIX '/stats/teams' in index.html
+ * Still a webroot in stats_show.html
+
Modified: branches/djamnedlies/stats/models.py
==============================================================================
--- branches/djamnedlies/stats/models.py (original)
+++ branches/djamnedlies/stats/models.py Sun Oct 26 20:44:14 2008
@@ -90,6 +90,10 @@
def __unicode__(self):
return "%s (%s)" % (self.name, self.locale)
+ @models.permalink
+ def get_absolute_url(self):
+ return ('language', [self.locale])
+
def bugs_url_enter(self):
return "http://bugzilla.gnome.org/enter_bug.cgi?product=l10n&component=%s%%20[%s]" % (self.name, self.locale)
@@ -522,7 +526,7 @@
LEFT JOIN domain ON domain.id=stat.domain_id
LEFT JOIN branch AS br ON br.id=stat.branch_id
LEFT JOIN category AS cat ON br.category_id=cat.id
- LEFT JOIN `release` AS rel ON rel.id = cat.release_id
+ LEFT JOIN release AS rel ON rel.id = cat.release_id
WHERE rel.id=%s AND stat.language_id IS NULL
GROUP BY domain.dtype """
cursor = connection.cursor()
@@ -737,7 +741,7 @@
""" String representation of the object """
return "%s (%s-%s) %s (%s)" % (self.branch.module.name, self.domain.dtype, self.domain.name,
self.branch.name, self.get_lang())
-
+
def is_fake(self):
return False
Modified: branches/djamnedlies/stats/urls.py
==============================================================================
--- branches/djamnedlies/stats/urls.py (original)
+++ branches/djamnedlies/stats/urls.py Sun Oct 26 20:44:14 2008
@@ -8,16 +8,16 @@
urlpatterns = patterns('stats.views',
(r'^/*$', 'index'),
- (r'^teams/*$', 'teams'),
+ url(r'^teams/*$', 'teams', name='teams'),
(r'^teams/(?P<name>.*)$', 'team'),
- (r'^languages/*$', 'languages'),
- (r'^languages/(?P<name>\w+)/$', 'team'),
- (r'^languages/(?P<langcode>\w+)/(?P<release_id>\d+)/$', 'languagerelease'),
+ url(r'^languages/*$', 'languages', name='languages'),
+ url(r'^languages/(?P<name>\w+)/$', 'team', name='language'),
+ url(r'^languages/(?P<langcode>\w+)/(?P<release_id>\d+)/$', 'languagerelease', name='languagerelease'),
(r'^people/*$', 'people'),
- (r'^module/*$', 'modules'),
+ url(r'^module/*$', 'modules', name='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'),
+ url(r'^releases/*$', 'releases', name='releases'),
(r'^releases/(?P<release_id>.*)$', 'release'),
)
Modified: branches/djamnedlies/stats/views.py
==============================================================================
--- branches/djamnedlies/stats/views.py (original)
+++ branches/djamnedlies/stats/views.py Sun Oct 26 20:44:14 2008
@@ -32,20 +32,24 @@
else:
translator_credits = translator_credits.split('\n')
- context = {'pageSection': "home",
- 'rtl': False,
- 'translator_credits': translator_credits }
+ context = {
+ 'pageSection': "home",
+ 'rtl': False,
+ 'translator_credits': translator_credits
+ }
return render_to_response('index.html', context)
def teams(request):
all_teams = Team.objects.all()
for t in all_teams:
- t.coordinator_url = "<a href='%s/people/%s'>%s</a>" % (settings.WEBROOT, t.coordinator.id, t.coordinator.name)
+ t.coordinator_url = "<a href='%s/people/%s'>%s</a>" % (
+ settings.WEBROOT, t.coordinator.id, t.coordinator.name)
- context = {'pageSection': "teams",
- 'webroot': settings.WEBROOT,
- 'teams': utils.sortObjectList(all_teams, 'description') }
- return render_to_response('list-teams.html', context)
+ context = {
+ 'pageSection': "teams",
+ 'teams': utils.sortObjectList(all_teams, 'description')
+ }
+ return render_to_response('team_list.html', context)
def team(request, name):
try:
@@ -56,75 +60,85 @@
language = Language.objects.get(locale=name)
team = {'description': name}
languages = [language]
- context = {'pageSection': "teams",
- 'webroot': settings.WEBROOT,
- 'team': team,
- 'languages': languages}
- return render_to_response('team.html', context)
+ context = {
+ 'pageSection': "teams",
+ 'team': team,
+ 'languages': languages}
+ return render_to_response('team_detail.html', context)
def languages(request):
all_languages = Language.objects.all()
- context = {'pageSection': "languages",
- 'languages': utils.sortObjectList(all_languages, 'name'),
- 'webroot': settings.WEBROOT }
- return render_to_response('list-languages.html', context)
+ context = {
+ 'pageSection': "languages",
+ 'languages': utils.sortObjectList(all_languages, 'name')
+ }
+ return render_to_response('language_list.html', context)
def people(request):
""" Print a list of all people in database """
all_people = Person.objects.all()
- context = {'pageSection': "teams",
- 'people': all_people,
- 'webroot': settings.WEBROOT }
+ context = {
+ 'pageSection': "teams",
+ 'people': all_people
+ }
return render_to_response('people.html', context)
def modules(request):
all_modules = Module.objects.all()
- context = {'pageSection': "module",
- 'webroot': settings.WEBROOT,
- 'modules': utils.sortObjectList(all_modules, 'description') }
- return render_to_response('list-modules.html', context)
+ context = {
+ 'pageSection': "module",
+ 'modules': utils.sortObjectList(all_modules, 'description')
+ }
+ return render_to_response('module_list.html', context)
def module(request, module_name):
mod = Module.objects.get(name = module_name)
mod.translated_name = _(mod.description)
- context = {'pageSection': "module",
- 'webroot': settings.WEBROOT,
- 'module': mod,
- 'prof': utils.Profiler() }
+ context = {
+ 'pageSection': "module",
+ 'webroot': settings.WEBROOT,
+ 'module': mod,
+ 'prof': utils.Profiler()
+ }
return render_to_response('module.html', context)
def docimages(request, module_name, potbase, branch_name, langcode):
mod = Module.objects.get(name = module_name)
- stat = Statistics.objects.get(branch__module=mod.id, branch__name=branch_name, domain__name=potbase, language__locale=langcode)
- context = {'pageSection': "module",
- 'webroot': settings.WEBROOT,
- 'module': mod,
- 'stat': stat }
- return render_to_response('module-images.html', context)
+ stat = Statistics.objects.get(branch__module=mod.id,
+ branch__name=branch_name,
+ domain__name=potbase,
+ language__locale=langcode)
+ context = {
+ 'pageSection': "module",
+ 'module': mod,
+ 'stat': stat
+ }
+ return render_to_response('module-_images.html', context)
def releases(request):
all_releases = Release.objects.order_by('status', '-name')
- context = {'pageSection': "releases",
- 'webroot': settings.WEBROOT,
- 'releases': all_releases }
- return render_to_response('list-releases.html', context)
+ context = {
+ 'pageSection': "releases",
+ 'releases': all_releases
+ }
+ return render_to_response('release_list.html', context)
def release(request, release_id):
rel = Release.objects.get(id=release_id)
- context = {'pageSection': "releases",
- 'webroot': settings.WEBROOT,
- 'release': rel }
+ context = {
+ 'pageSection': "releases",
+ 'release': rel
+ }
return render_to_response('release.html', context)
def languagerelease(request, langcode, release_id):
rel = Release.objects.get(id=release_id)
lang = Language.objects.get(locale=langcode)
rel_stats = rel.get_lang_stats(lang)
- context = {'pageSection': "languages",
- 'webroot': settings.WEBROOT,
- 'language': lang,
- 'release': rel,
- 'stats': rel_stats}
- return render_to_response('language-release.html', context)
-
-
+ context = {
+ 'pageSection': "languages",
+ 'language': lang,
+ 'release': rel,
+ 'stats': rel_stats
+ }
+ return render_to_response('language_release.html', context)
Modified: branches/djamnedlies/urls.py
==============================================================================
--- branches/djamnedlies/urls.py (original)
+++ branches/djamnedlies/urls.py Sun Oct 26 20:44:14 2008
@@ -5,14 +5,9 @@
admin.autodiscover()
urlpatterns = patterns('',
- # Uncomment the admin/doc line below and add 'django.contrib.admindocs'
- # to INSTALLED_APPS to enable admin documentation:
- # (r'^admin/doc/', include('django.contrib.admindocs.urls')),
-
+ url(r'^$', 'stats.views.index', name='home'),
(r'^admin/(.*)', admin.site.root),
-
(r'^stats/', include('stats.urls')),
-
)
if settings.STATIC_SERVE:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]