Monday, May 30, 2011

admin site search field

Hi, I'm new and I'm trying to make an app that have a field, pointing
to a record of the same object class. How can a make django has a
search form and show the record of the class on a popup window like
http://demoweb.cibernatural.com/admin/gestion/presupuesto/add/ (user
and password demo:demo) but pointing to the same class


class afiliado(models.Model):
def __unicode__(self):
return self.nombre
nombre = models.CharField("Nombre",max_length=200)
fecha_nac = models.DateField("Fecha Nacimiento")
doc = models.CharField("Documento",max_length=20,blank =True)
obra_social = models.ForeignKey(obra_sociale)
caracter = models.ForeignKey(caractere)
tipo = models.ForeignKey(tipo)
titular = models.CharField(max_length=200) ------------> this
field


class AfiliadoAdmin(admin.ModelAdmin):
fieldsets = [
(None ,{'fields':
['nombre','fecha_nac','DOCN','Nacionalidad']}),
('Datos Generales' ,{'fields':
['obra_social','caracter','tipo',"titular",'Matricula','fecha_ing']}),
('Datos de contacto',{'fields':
['Direccion',"CP","Ciudad","Provincia","Tel1","Tel2","Email"]}),
]
list_display = ('nombre',"tipo")
list_filter = ['Ciudad']
search_fields = ['nombre','doc]


Thansk!

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment