from django.contrib import admin from exile_ui.admin import admin_site, ExStacked, ExTabular, DateRangeEX import models import forms class OperarioAdmin(admin.ModelAdmin): list_display = ('username', 'email', 'first_name', 'last_name', 'turno') search_fields = ('username', 'email', 'first_name', 'last_name') list_filter = ('turno', ) form = forms.OperarioForm admin_site._registry = admin.site._registry admin_site.register(models.Operario, OperarioAdmin)
class TipoActividadAdmin(admin.ModelAdmin): form = forms.TipoActividadForm list_display = ('nombre', ) serarch_fields = list_display # end class class ActividadAdmin(admin.ModelAdmin): form = forms.ActividadForm list_display = ( 'nombre', 'lugar', 'objeto', 'tipo_de_actividad', 'fecha_de_ejecucion', ) serarch_fields = ('nombre', ) list_filter = ( 'tipo_de_actividad', ('fecha_de_ejecucion', DateRangeEX), ) # end class admin_site.register(models.TipoActividad, TipoActividadAdmin) admin_site.register(models.Actividad, ActividadAdmin) admin_site.register(models.Lugar)
from django.contrib import admin from exile_ui.admin import admin_site, ExStacked, ExTabular, DateRangeEX from sorl.thumbnail.admin import AdminImageMixin import forms import models # Register your models here. class CiudadanoAdmin(AdminImageMixin, admin.ModelAdmin): list_display = ('username', 'email', 'first_name', 'last_name', 'identificacion', 'telefono', 'fijo', 'fecha_nacimiento', 'avatar') search_fields = ('username', 'email', 'first_name', 'last_name', 'identificacion', 'telefono') list_filter = (('fecha_nacimiento', DateRangeEX), ) form = forms.CiudadanoForm class Media: js = ("ciudadanos/js/validation.js", ) # end class # end class admin_site.register(models.Departamento) admin_site.register(models.Municipio) admin_site.register(models.Ciudadano, CiudadanoAdmin)
from django.contrib import admin from exile_ui.admin import admin_site, ExStacked, ExTabular, DateRangeEX, DateRangeEX import models admin_site.register(models.Empresa) admin_site.register(models.Ciudad) admin_site.register(models.Planta) admin_site.register(models.Unidad) admin_site.register(models.Turno) admin_site.register(models.Equipo)
from django.contrib import admin from django.contrib import admin import nested_admin import forms import models from exile_ui.admin import admin_site class QuestionAdmin(nested_admin.NestedModelAdmin): list_display = ('email', 'pregunta') search_fields = list_display def get_queryset(self, request): print request.user.id return models.Pregunta.objects.filter( state=False, departamento__jefes__empleado__id=request.user.id) # end def # Register your models here. admin_site.register(models.Pregunta, QuestionAdmin)
# end class class TarjetaAdmin(admin.ModelAdmin): list_display = ('ciudadano', 'registro', 'cedula', 'sellos', 'fecha', 'tramitado') search_fields = ('ciudadano__first_name', 'ciudadano__last_name', 'ciudadano__indentificacion') list_editable = ('tramitado', ) list_filter = list_editable # end class class Pasaporte(admin.ModelAdmin): list_display = ('ciudadano', 'cedula', 'foto', 'fecha', 'tramitado') search_fields = ('ciudadano__first_name', 'ciudadano__last_name', 'ciudadano__indentificacion') list_editable = ('tramitado', ) list_filter = list_editable # end class admin_site.register(models.RegistroProS, ProSAdmin) admin_site.register(models.RegistroProN, ProNAdmin) admin_site.register(models.TarjetaPro, TarjetaAdmin) admin_site.register(models.Pasaporte, Pasaporte)
# end class class DepartamentoAdmin(nested_admin.NestedModelAdmin): list_display = ('nombre', ) search_fields = list_display inlines = [PrengustasDepartamento] class EmpleadoAdmin(nested_admin.NestedModelAdmin): list_display = ('username', 'email', 'first_name', 'last_name', 'direccion', 'telefono', 'fecha_nacimiento') search_fields = list_display def get_form(self, request, obj=None, *args, **kwargs): if obj: kwargs['form'] = forms.EmpleadoEditForm # end if return super(EmpleadoAdmin, self).get_form(request, obj, *args, **kwargs) # end def admin_site._registry = admin.site._registry admin_site.register(models.Empleado, EmpleadoAdmin) admin_site.register(models.Departamento, DepartamentoAdmin) admin_site.register(models.Cargo) admin_site.register(models.Jefes)