Exemple #1
0
def filter_list(request):
    form = SearchForm(request.GET)
    instances = []

    if form.is_valid():
        search_params = {
            'space_name': form.cleaned_data['space'],
            'area_name': form.cleaned_data['area'],
            'search_string': form.cleaned_data['keyword'],
            'start_date': form.cleaned_data.get('start'),
            'end_date': form.cleaned_data.get('end')
        }

        instances = Instance.objects.search(**search_params).order_by('start')

    return render(request, 'list_content.html', {'list_instances': instances})
Exemple #2
0
def filter_list(request):
  form = SearchForm(request.GET)
  instances = []

  if form.is_valid():
    search_params = {
      'space_name': form.cleaned_data['space'],
      'area_name': form.cleaned_data['area'],
      'search_string': form.cleaned_data['keyword'],
      'start_date': form.cleaned_data.get('start'),
      'end_date': form.cleaned_data.get('end')
    }

    instances = Instance.objects.search(**search_params).order_by('start')

  return render(request, 'list_content.html', {
    'list_instances': instances
  })
Exemple #3
0
def filter_calendar(request):
  form = SearchForm(request.GET)
  now = timezone.now()

  if form.is_valid():
    search_params = {
      'space_name': form.cleaned_data['space'],
      'area_name': form.cleaned_data['area'],
      'search_string': form.cleaned_data['keyword'],
      'year': form.cleaned_data.get('year', now.year),
      'month': form.cleaned_data.get('month', now.month)
    }

    calendar_instances = Instance.objects.search(**search_params)
    calendar_helper = CalendarHelper(year=search_params['year'], month=search_params['month'], instances=calendar_instances)

  return render(request, 'calendar_content.html', {
    'calendar': calendar_helper
  })
Exemple #4
0
def filter_calendar(request):
    form = SearchForm(request.GET)
    now = timezone.now()

    if form.is_valid():
        search_params = {
            'space_name': form.cleaned_data['space'],
            'area_name': form.cleaned_data['area'],
            'search_string': form.cleaned_data['keyword'],
            'year': form.cleaned_data.get('year', now.year),
            'month': form.cleaned_data.get('month', now.month)
        }

        calendar_instances = Instance.objects.search(**search_params)
        calendar_helper = CalendarHelper(year=search_params['year'],
                                         month=search_params['month'],
                                         instances=calendar_instances)

    return render(request, 'calendar_content.html',
                  {'calendar': calendar_helper})