Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

202
Visualizações
filter by default with now() and earlier djangorestframework

I'm passing date parameters from angualrjs controller to my restapi, now the date parameter is not specified so I need to filter by default with now() and earlier on parameter which I'm sending to restapi so if I'm understanding correctly filter should be in the get function on the view, probably, like I said probably because I'm in a dilemma on this one, and asking from someone to explain to me how can I do this. You can check my controller and view down bellow.

app = angular.module 'cms.sales'

app.controller 'FilterContactsListCtrl', ['$scope', '$http',
  ($scope, $http) ->
    savedSuccessMessage = "Contact leads list was updated"
    savedFailMessage = "Failed to update contact leads list"
    $scope.selectDate = null

    $scope.init = (nextSelectedDate)->
      if nextSelectedDate
        $scope.selectDate = nextSelectedDate
      else
        $scope.selectDate = ""


    $scope.doAction = () ->
      data = {
        select_date: $scope.selectDate
      }
      $http.post("/api/sales/lead_contact/", data).then(
        nextContactListUpdateSuccess, nextContactListUpdateFailed
      )

    nextContactListUpdateSuccess = ()->
      ClientNotifications.showNotification("Success", "Contact Leads list page was updated", "success")

    nextContactListUpdateFailed = () ->
      ClientNotifications.showNotification("Alert", "Failed to update contact leads list page", "alert")

]

ModelViewSet:

class LeadContactViewSet(viewsets.ModelViewSet):
    def get_queryset(self):
        queryset = LeadContact.objects.none()
        user = self.request.user
        if user.has_perm('vinclucms_sales.can_view_full_lead_contact_list'):
            queryset = LeadContact.objects.all()
        elif user.has_perm('cms_sales.can_view_lead_contact'):
            queryset = LeadContact.objects.filter(account_handler=user)
        return queryset

    # rest of the view below
    .....
over 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda