original_docstring: Return survey creator's surveys, ordered by date of publication.
      If anon, view published surveys which are available to public.
docstring: Return survey creator's surveys, ordered by date of publication.
  If anon, view published surveys which are available to public.
docstring_tokens: Return survey creator ' s surveys ordered by date of publication . If anon view published surveys which are available to public .
code: def survey_index(request):
      """Return survey creator's surveys, ordered by date of publication.
      If anon, view published surveys which are available to public."""
      if request.user.is_authenticated:
          latest_survey_list = Survey.objects.filter(
              author=request.user,
          ).order_by('-pub_date')
          my_surveys = Survey.objects.filter(author=request.user).order_by('title')
          return render(request,
                        'skip_logic/survey_index.html',
                        {'latest_survey_list': latest_survey_list, 'my_surveys': my_surveys})
  
      latest_survey_list = Survey.objects.filter(
          is_public=True,
          pub_date__lte=timezone.now(),
      ).order_by('title')
  
      return render(request,
                    'skip_logic/survey_index_public.html',
                    {'latest_survey_list': latest_survey_list})
code_tokens: def survey_index ( request ) : if request . user . is_authenticated : latest_survey_list = Survey . objects . filter ( author = request . user , ) . order_by ( '-pub_date' ) my_surveys = Survey . objects . filter ( author = request . user ) . order_by ( 'title' ) return render ( request , 'skip_logic/survey_index.html' , { 'latest_survey_list' : latest_survey_list , 'my_surveys' : my_surveys } ) latest_survey_list = Survey . objects . filter ( is_public = True , pub_date__lte = timezone . now ( ) , ) . order_by ( 'title' ) return render ( request , 'skip_logic/survey_index_public.html' , { 'latest_survey_list' : latest_survey_list } )
short_docstring: Return survey creator's surveys, ordered by date of publication.
short_docstring_tokens: Return survey creator ' s surveys ordered by date of publication .
comment: """Return survey creator's surveys, ordered by date of publication.
      If anon, view published surveys which are available to public."""