Beispiel #1
0
 def get(self, request, *args, **kwargs):
     secretary = get_person_by_position('Secretary')
     tour_coordinator = get_person_by_position('Tour Coordinator (Primary)',
                                               'Tour Coordinator')
     markdown = render_to_string('public/documentation.md', {
         'tour_coordinator': tour_coordinator,
         'secretary': secretary
     })
     return render(request, 'public/help.html', {'markdown': markdown})
Beispiel #2
0
    def get(self, request, *args, **kwargs):
        if kwargs.get("public"):
            # make sure this user is active
            if not request.user.person.is_active:
                raise PermissionDenied
        else:
            # make sure this is a board member
            try:
                request.user.groups.get(name="Board Members")
            except Group.DoesNotExist:
                raise PermissionDenied

        now = utils.now()
        year = kwargs.get("year")
        month = kwargs.get("month")
        year, month = utils.parse_year_month(year, month)
        months_list = [(num, name) for num, name in enumerate(list(calendar.month_name)) if num != 0]
        date = datetime.date(year, month, 1)
        next_month = date + relativedelta(months=1)
        prev_month = date + relativedelta(months=-1)
        primary_tour_coordinator = get_person_by_position("Tour Coordinator (Primary)", "Tour Coordinator")

        is_open, date_closes = tours_utils.month_is_open(month=month, year=year, return_tuple=True)

        if is_open:
            public_url = request.build_absolute_uri(
                unicode(reverse("public:month", kwargs={"year": year, "month": month}))
            )
        else:
            public_url = None

        open_eligible = tours_utils.open_eligible(month=month, year=year)

        weeks_with_tours = tours_utils.weeks_with_tours(month=month, year=year)

        context = {
            "months_list": months_list,
            "weeks": weeks_with_tours,
            "now": now,
            "month": month,
            "year": year,
            "next_year": (year + 1),
            "prev_year": (year - 1),
            "next_month": next_month,
            "prev_month": prev_month,
            "month_initialized": tours_utils.is_initialized(month=month, year=year),
            "is_open": is_open,
            "date_closes": date_closes,
            "open_eligible": open_eligible,
            "public_url": public_url,
            "primary_tour_coordinator": primary_tour_coordinator,
        }

        if kwargs.get("public"):
            return render(request, "public/month.html", context)
        elif kwargs.get("print") is True:
            return render(request, "tours/month_print.html", context)
        else:
            return render(request, "tours/month.html", context)
Beispiel #3
0
    def get(self, request, *args, **kwargs):
        if kwargs.get('public'):
            # make sure this user is active
            if not request.user.person.is_active:
                raise PermissionDenied
        else:
            # make sure this is a board member
            try:
                request.user.groups.get(name='Board Members')
            except Group.DoesNotExist:
                raise PermissionDenied

        now = utils.now()
        year = kwargs.get('year')
        month = kwargs.get('month')
        year, month = utils.parse_year_month(year, month)
        months_list = [(num, name)
                       for num, name in enumerate(list(calendar.month_name))
                       if num != 0]
        date = datetime.date(year, month, 1)
        next_month = date + relativedelta(months=1)
        prev_month = date + relativedelta(months=-1)
        primary_tour_coordinator = get_person_by_position(
            'Tour Coordinator (Primary)', 'Tour Coordinator')

        is_open, date_closes = tours_utils.month_is_open(month=month,
                                                         year=year,
                                                         return_tuple=True)

        if is_open:
            public_url = request.build_absolute_uri(
                unicode(
                    reverse('public:month',
                            kwargs={
                                'year': year,
                                'month': month
                            })))
        else:
            public_url = None

        open_eligible = tours_utils.open_eligible(month=month, year=year)

        weeks_with_tours = tours_utils.weeks_with_tours(month=month, year=year)

        context = {
            'months_list': months_list,
            'weeks': weeks_with_tours,
            'now': now,
            'month': month,
            'year': year,
            'next_year': (year + 1),
            'prev_year': (year - 1),
            'next_month': next_month,
            'prev_month': prev_month,
            'month_initialized': tours_utils.is_initialized(month=month,
                                                            year=year),
            'is_open': is_open,
            'date_closes': date_closes,
            'open_eligible': open_eligible,
            'public_url': public_url,
            'primary_tour_coordinator': primary_tour_coordinator,
        }

        if kwargs.get('public'):
            return render(request, 'public/month.html', context)
        elif kwargs.get('print') is True:
            return render(request, 'tours/month_print.html', context)
        else:
            return render(request, 'tours/month.html', context)
Beispiel #4
0
 def get(self, request, *args, **kwargs):
     secretary = get_person_by_position('Secretary')
     tour_coordinator = get_person_by_position('Tour Coordinator (Primary)', 'Tour Coordinator')
     markdown = render_to_string('public/documentation.md', {'tour_coordinator': tour_coordinator, 'secretary': secretary})
     return render(request, 'public/help.html', {'markdown': markdown})