Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modal form para crear nuevos clientes, proveedores, etc mediante Ajax. #17

Open
marcorichetta opened this issue May 29, 2020 · 0 comments
Labels
nice to have Something not really necessary or urgent

Comments

@marcorichetta
Copy link
Owner

marcorichetta commented May 29, 2020

from dal import autocomplete

class PacienteAutocomplete(autocomplete.Select2QuerySetView):
    """
    Base de autompletado para pacientes.
    """

    def get_queryset(self):
        if not self.request.user.has_perm('pacientes.view_paciente'):
            return Paciente.objects.none()

        qs = Paciente.objects.all()

        if self.q:
            qs = qs.filter(Q(numero_documento__icontains=self.q) |
                           Q(nombres__icontains=self.q) |
                           Q(apellidos__icontains=self.q)
                           )

        return qs.order_by("apellidos", "nombres")[:5]

Ejemplo Localidad

def LocalidadCreate(request):

@marcorichetta marcorichetta added the nice to have Something not really necessary or urgent label Jun 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nice to have Something not really necessary or urgent
Projects
None yet
Development

No branches or pull requests

1 participant