changeset 276:f30299911fe3

Admin interface for jobs
author Sylvain Beucler <beuc@beuc.net>
date Fri, 13 Aug 2010 07:49:06 +0200
parents 752ae7463b2d
children 2d359c38b52a
files savane/svmain/admin.py savane/svpeople/admin.py savane/svpeople/models.py
diffstat 3 files changed, 68 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/savane/svmain/admin.py
+++ b/savane/svmain/admin.py
@@ -1,5 +1,22 @@
+# User/group admin interface
+# Copyright (C) 2009, 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.contrib import admin
-from django.contrib.auth import admin as auth_admin
 from django.utils.translation import ugettext, ugettext_lazy as _
 import models as svmain_models
 
@@ -87,6 +104,7 @@
     #filter_horizontal = ('permissions',)
     list_display  = ('pk', 'full_name', 'type', 'license',)
     list_filter = ('type', 'license', 'devel_status',)
+    date_hierarchy = 'register_time'
 
 class MailingListAdmin(admin.ModelAdmin):
     search_fields = ('list_name',)
new file mode 100644
--- /dev/null
+++ b/savane/svpeople/admin.py
@@ -0,0 +1,46 @@
+# User/group admin interface
+# Copyright (C) 2009, 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.contrib import admin
+from django.utils.translation import ugettext, ugettext_lazy as _
+from models import *
+
+class JobAdmin(admin.ModelAdmin):
+    search_fields = ('title',)
+    ordering = ('date',)
+    list_display  = ('pk', 'title', 'category', 'status', 'group', 'created_by',)
+    list_filter = ('status', 'category',)
+    date_hierarchy = 'date'
+
+
+class LabelAdmin(admin.ModelAdmin):
+    ordering = ('id'),
+    list_display = ['id', 'label', 'active']
+    list_display_links = ['id']
+    list_editable = ['label', 'active']
+    list_filter = ['active']
+    search_fields = ['libelle']
+
+
+admin.site.register(Job, JobAdmin)
+admin.site.register(Skill, LabelAdmin)
+admin.site.register(SkillYear, LabelAdmin)
+admin.site.register(SkillLevel, LabelAdmin)
+admin.site.register(Category, LabelAdmin)
+
+# TODO: JobInventory and SkillInventory
--- a/savane/svpeople/models.py
+++ b/savane/svpeople/models.py
@@ -55,6 +55,9 @@
         return "%s" % (self.label)
 
 class Category(Label):
+    class Meta:
+        verbose_name = _("category")
+        verbose_name_plural = _("categories")
     def open_job_set(self):
         return self.job_set.filter(status=1)