Skip to content

Commit

Permalink
quitando modalidad de apoyo de organizacion, agregada a proyecto
Browse files Browse the repository at this point in the history
  • Loading branch information
eos87 committed Feb 6, 2011
1 parent 2b5bc9d commit 3a81dbb
Show file tree
Hide file tree
Showing 5 changed files with 810 additions and 33 deletions.
18 changes: 14 additions & 4 deletions encuesta/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,18 @@ def queryset(self, request):
return Organizacion.objects.filter(user=request.user)

def get_form(self, request, obj=None, ** kwargs):
if request.user.is_superuser:
grupos = request.user.groups.all()
fed = Group.objects.get(name='FED')
if request.user.is_superuser or fed in grupos:
form = super(OrganizacionAdmin, self).get_form(self, request, ** kwargs)
form.base_fields['user'].queryset = User.objects.order_by('username')
else:
form = super(OrganizacionAdmin, self).get_form(self, request, ** kwargs)
form.base_fields['user'].queryset = User.objects.filter(pk=request.user.pk)
return form

save_on_top = True
actions_on_top = True
list_filter = ['user']
list_display = ['nombre_corto', 'user', 'correo', 'telefono', 'contacto']
search_fields = ['nombre_corto', 'user__username', 'telefono', 'contacto']
Expand All @@ -33,15 +38,20 @@ def queryset(self, request):
return Proyecto.objects.filter(user=request.user)

def get_form(self, request, obj=None, ** kwargs):
if request.user.is_superuser:
grupos = request.user.groups.all()
fed = Group.objects.get(name='FED')
if request.user.is_superuser or fed in grupos:
form = super(ProyectoAdmin, self).get_form(self, request, ** kwargs)
form.base_fields['user'].queryset = User.objects.order_by('username')
else:
form = super(ProyectoAdmin, self).get_form(self, request, ** kwargs)
form.base_fields['user'].queryset = User.objects.filter(pk=request.user.pk)
return form

list_filter = ['user']
list_display = ['nombre', 'user', 'organizacion']
save_on_top = True
actions_on_top = True
list_filter = ['organizacion']
list_display = ['nombre', 'organizacion', 'tipo', 'user']
search_fields = ['nombre', 'user__username', 'organizacion__nombre', 'organizacion__nombre_corto']

admin.site.register(Organizacion, OrganizacionAdmin)
Expand Down
Loading

0 comments on commit 3a81dbb

Please sign in to comment.