from django.contrib.auth.decorators import user_passes_test, login_required
from django.shortcuts import render
from perfiles_usuario.utils import is_capturista
from estudios_socioeconomicos.models import Estudio


@login_required
#@user_passes_test(is_capturista)
def capturista_dashboard(request):
    """View to render the capturista control dashboard.

       This view shows the list of socio-economic studies that are under review
       and the action buttons to add and edit each socio-economic study.
    """
    estudios = []
    iduser = request.user.id
    rechazados = Estudio.objects.filter(status='rechazado')
    for estudio in rechazados:
        if estudio.capturista_id == iduser:
            estudios.append(estudio)
    return render(request, 'captura/dashboard_capturista.html',
                  {'estudios': estudios})

from django.contrib.auth.decorators import user_passes_test, login_required
from django.shortcuts import render
from perfiles_usuario.utils import is_capturista
from estudios_socioeconomicos.models import Estudio


@login_required
@user_passes_test(is_capturista)
def capturista_dashboard(request):
    """View to render the capturista control dashboard.

       This view shows the list of socio-economic studies that are under review
       and the button to add a new socio-economic study.
       Also shows the edit and see feedback buttons to each socio-economic study
       shown in the list if this exist for the current user (capturist).
    """
    estudios = []
    iduser = request.user.id
    rechazados = Estudio.objects.filter(status='rechazado')
    for estudio in rechazados:
        if estudio.capturista_id == iduser:
            estudios.append(estudio)
    return render(request, 'captura/dashboard_capturista.html',
                  {'estudios': estudios})

Add more comments in capturist dashboard view
Add more comments in capturist dashboard view

  from django.contrib.auth.decorators import user_passes_test, login_required
  from django.shortcuts import render
  from perfiles_usuario.utils import is_capturista
  from estudios_socioeconomicos.models import Estudio
  
  
  @login_required
- #@user_passes_test(is_capturista)
+ @user_passes_test(is_capturista)
  def capturista_dashboard(request):
      """View to render the capturista control dashboard.
  
         This view shows the list of socio-economic studies that are under review
-        and the action buttons to add and edit each socio-economic study.
+        and the button to add a new socio-economic study.
+        Also shows the edit and see feedback buttons to each socio-economic study
+        shown in the list if this exist for the current user (capturist).
      """
      estudios = []
      iduser = request.user.id
      rechazados = Estudio.objects.filter(status='rechazado')
      for estudio in rechazados:
          if estudio.capturista_id == iduser:
              estudios.append(estudio)
      return render(request, 'captura/dashboard_capturista.html',
                    {'estudios': estudios})
  
Add more comments in capturist dashboard view
## Code Before:
from django.contrib.auth.decorators import user_passes_test, login_required
from django.shortcuts import render
from perfiles_usuario.utils import is_capturista
from estudios_socioeconomicos.models import Estudio


@login_required
#@user_passes_test(is_capturista)
def capturista_dashboard(request):
    """View to render the capturista control dashboard.

       This view shows the list of socio-economic studies that are under review
       and the action buttons to add and edit each socio-economic study.
    """
    estudios = []
    iduser = request.user.id
    rechazados = Estudio.objects.filter(status='rechazado')
    for estudio in rechazados:
        if estudio.capturista_id == iduser:
            estudios.append(estudio)
    return render(request, 'captura/dashboard_capturista.html',
                  {'estudios': estudios})

## Instruction:
Add more comments in capturist dashboard view
## Code After:
from django.contrib.auth.decorators import user_passes_test, login_required
from django.shortcuts import render
from perfiles_usuario.utils import is_capturista
from estudios_socioeconomicos.models import Estudio


@login_required
@user_passes_test(is_capturista)
def capturista_dashboard(request):
    """View to render the capturista control dashboard.

       This view shows the list of socio-economic studies that are under review
       and the button to add a new socio-economic study.
       Also shows the edit and see feedback buttons to each socio-economic study
       shown in the list if this exist for the current user (capturist).
    """
    estudios = []
    iduser = request.user.id
    rechazados = Estudio.objects.filter(status='rechazado')
    for estudio in rechazados:
        if estudio.capturista_id == iduser:
            estudios.append(estudio)
    return render(request, 'captura/dashboard_capturista.html',
                  {'estudios': estudios})
