damned-lies r1136 - in branches/djamnedlies: . languages stats teams
- From: stephaner svn gnome org
- To: svn-commits-list gnome org
- Subject: damned-lies r1136 - in branches/djamnedlies: . languages stats teams
- Date: Fri, 7 Nov 2008 14:50:33 +0000 (UTC)
Author: stephaner
Date: Fri Nov 7 14:50:33 2008
New Revision: 1136
URL: http://svn.gnome.org/viewvc/damned-lies?rev=1136&view=rev
Log:
2008-11-07 StÃphane Raimbault <stephane raimbault gmail com>
* languages/admin.py:
* stats/admin.py:
* stats/models.py:
* teams/admin.py: Enhanced administration interface (display name,
search, ordering, etc).
Modified:
branches/djamnedlies/ChangeLog
branches/djamnedlies/languages/admin.py
branches/djamnedlies/stats/admin.py
branches/djamnedlies/stats/models.py
branches/djamnedlies/teams/admin.py
Modified: branches/djamnedlies/languages/admin.py
==============================================================================
--- branches/djamnedlies/languages/admin.py (original)
+++ branches/djamnedlies/languages/admin.py Fri Nov 7 14:50:33 2008
@@ -1,4 +1,7 @@
from django.contrib import admin
from languages.models import Language
-admin.site.register(Language)
+class LanguageAdmin(admin.ModelAdmin):
+ search_fields = ('name', 'locale')
+
+admin.site.register(Language, LanguageAdmin)
Modified: branches/djamnedlies/stats/admin.py
==============================================================================
--- branches/djamnedlies/stats/admin.py (original)
+++ branches/djamnedlies/stats/admin.py Fri Nov 7 14:50:33 2008
@@ -19,23 +19,12 @@
# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
from django.contrib import admin
-from django import forms
from stats.models import Statistics, Module, Branch, Category, Release
-class ReleaseAdmin(admin.ModelAdmin):
- list_display = ('name', 'status', 'stringfrozen')
-
-class ModuleForm(forms.ModelForm):
- description = forms.CharField(max_length=40, widget=forms.TextInput())
-
- class Meta:
- model = Module
-
class BranchInline(admin.TabularInline):
model = Branch
class ModuleAdmin(admin.ModelAdmin):
- #form = ModuleForm
fieldsets = (
(None, {
'fields': (('name','description'),
@@ -46,10 +35,31 @@
}),
)
inlines = [ BranchInline, ]
-
-admin.site.register(Statistics)
+ search_fields = ('name',)
+
+ def formfield_for_dbfield(self, db_field, **kwargs):
+ field = super(ModuleAdmin, self).formfield_for_dbfield(db_field, **kwargs)
+ if db_field.name == 'description':
+ field.widget.attrs['rows'] = '1'
+ elif db_field.name == 'comment':
+ field.widget.attrs['rows'] = '4'
+
+ return field
+
+class BranchAdmin(admin.ModelAdmin):
+ search_fields = ('name', 'module__name')
+
+class CategoryAdmin(admin.ModelAdmin):
+ search_fields = ('category', 'branch__module__name')
+
+class ReleaseAdmin(admin.ModelAdmin):
+ list_display = ('name', 'status', 'stringfrozen')
+
+class StatisticsAdmin(admin.ModelAdmin):
+ search_fields = ('language__name', 'branch__module__name')
+
+admin.site.register(Statistics, StatisticsAdmin)
+admin.site.register(Branch, BranchAdmin)
+admin.site.register(Category, CategoryAdmin)
admin.site.register(Module, ModuleAdmin)
-admin.site.register(Branch)
-admin.site.register(Category)
admin.site.register(Release, ReleaseAdmin)
-
Modified: branches/djamnedlies/stats/models.py
==============================================================================
--- branches/djamnedlies/stats/models.py (original)
+++ branches/djamnedlies/stats/models.py Fri Nov 7 14:50:33 2008
@@ -100,10 +100,11 @@
class Meta:
db_table = 'branch'
- verbose_name_plural = "branches"
-
+ verbose_name_plural = 'branches'
+ ordering = ('name',)
+
def __unicode__(self):
- return "Branch: %s" % self.name
+ return "%s (%s)" % (self.name, self.module)
def is_head(self):
if self.module.vcs_type in ('cvs', 'svn') and self.name == "HEAD":
@@ -426,6 +427,9 @@
class Meta:
db_table = 'domain'
+ def __unicode__(self):
+ return self.get_dtype_display()
+
def potbase(self):
if self.name[:2] == 'po':
return self.module.name + self.name[2:]
@@ -685,7 +689,10 @@
class Meta:
db_table = 'category'
+ verbose_name_plural = 'categories'
+ def __unicode__(self):
+ return "%s (%s, %s)" % (self.get_category_display(), self.release, self.branch)
class Statistics(models.Model):
branch = models.ForeignKey(Branch)
Modified: branches/djamnedlies/teams/admin.py
==============================================================================
--- branches/djamnedlies/teams/admin.py (original)
+++ branches/djamnedlies/teams/admin.py Fri Nov 7 14:50:33 2008
@@ -1,4 +1,15 @@
from django.contrib import admin
from teams.models import Team
-admin.site.register(Team)
+class TeamAdmin(admin.ModelAdmin):
+ search_fields = ('name',)
+
+ def formfield_for_dbfield(self, db_field, **kwargs):
+ # Reduced text area for aliases
+ field = super(TeamAdmin, self).formfield_for_dbfield(db_field, **kwargs)
+ if db_field.name == 'description':
+ field.widget.attrs['rows'] = '4'
+
+ return field
+
+admin.site.register(Team, TeamAdmin)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]