adremides

Untitled

Nov 21st, 2020
710
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # models.py
  2. class Paciente(models.Model):
  3.     apellidos = models.CharField(max_length=50, null=True)
  4.     nombres = models.CharField(max_length=50, null=True)
  5.  
  6.     def __str__(self):
  7.         return '%s, %s' % (self.apellidos, self.nombres)
  8.  
  9.    
  10. class Orden_Trabajo(models.Model):
  11.     paciente = models.ForeignKey(Paciente, on_delete=models.CASCADE)
  12.  
  13.  
  14. # views.py
  15. class PacienteCRUD(CRUDView):
  16.     model = Paciente
  17.     list_filter = ['paciente']  # <--- not working
  18.     list_fields = ['apellidos', 'nombres']
  19.    
  20.  
  21. class Orden_TrabajoCRUD(CRUDView):
  22.     model = Orden_Trabajo
  23.     list_filter = ['paciente']  # <--- it is working
RAW Paste Data