Пример #1
0
 def test_post_request_valid_form(self):
     user = self.login_user()
     form_data = {
         'start_time': datetime.time(7, 0),
         'end_time': datetime.time(8, 0),
         'task_desc': 'Test task',
     }
     response = self.client.post(path=self.path, data=form_data, HTTP_X_REQUESTED_WITH='XMLHttpRequest')
     self.assertEqual(200, response.status_code)
     saved_task = user.dayschedules.current_schedule.tasks.get(task_desc='Test task')
     self.assertEqual(saved_task.start_time, form_data['start_time'])
     self.assertEqual(saved_task.end_time, form_data['end_time'])
     self.assertEqual(saved_task.task_desc, form_data['task_desc'])
     response_data = response.json()
     self.assertEqual(saved_task.id, response_data['taskId'])
     self.assertEqual(
         self.encoder.encode(defaultfilters.time(form_data['start_time'], 'H:i')),
         self.encoder.encode(response_data['taskStartTime'])
     )
     self.assertEqual(
         self.encoder.encode(defaultfilters.time(form_data['end_time'], 'H:i')),
         self.encoder.encode(response_data['taskEndTime'])
     )
     self.assertEqual(
         self.encoder.encode(form_data['task_desc']),
         self.encoder.encode(response_data['taskDesc'])
     )
Пример #2
0
 def post(self, request, *args, **kwargs):
     task_id = int(request.POST.get('task_id'))
     try:
         task_obj = request.user.dayschedules.current_schedule.tasks.get(
             id=task_id)
     except exceptions.ObjectDoesNotExist:
         return http.JsonResponse(
             {'ERROR': f'Could not retrieve task({task_id})'}, status=400)
     filled_task_form = kernel_forms.TaskUpdateForm(self.request.POST,
                                                    instance=task_obj)
     if filled_task_form.is_valid():
         filled_task_form.save()
         return http.JsonResponse({
             'taskId':
             task_id,
             'taskStartTime':
             defaultfilters.time(
                 filled_task_form.cleaned_data['start_time'], 'H:i'),
             'taskEndTime':
             defaultfilters.time(filled_task_form.cleaned_data['end_time'],
                                 'H:i'),
             'taskDesc':
             filled_task_form.cleaned_data['task_desc'],
         })
     else:
         return http.JsonResponse({'FORM_ERRORS': filled_task_form.errors},
                                  status=400)
Пример #3
0
def between_datetimes(from_date, to_date, whole_day=True):
    if not to_date:
        return single_datetime(from_date, whole_day)
    if whole_day:
        if from_date.day == to_date.day:
            return date(from_date, "DATE_FORMAT")
        else:
            return u"%s – %s" % (
                date(from_date, "DATE_FORMAT"),
                date(to_date, "DATE_FORMAT"),
            )
    else:
        if from_date.day == to_date.day:
            return u"%s, %s – %s" % (
                date(from_date, "DATE_FORMAT"),
                time(from_date, "TIME_FORMAT"),
                time(to_date, "TIME_FORMAT"),
            )
        else:
            return u"%s, %s – %s, %s" % (
                date(from_date, "DATE_FORMAT"),
                time(from_date, "TIME_FORMAT"),
                date(to_date, "DATE_FORMAT"),
                time(to_date, "TIME_FORMAT"),
            )
Пример #4
0
def format_event_time(event):
    """
    Input: object with required start_date, optional end_date, start_time, end_time
    """
    # format everything
    start_date = date(event.start_date, "l, N jS")
    end_date = date(event.end_date, "l, N jS")
    start_time = time(event.start_time)
    end_time = time(event.end_time)

    # just times
    if event.end_date in [None, event.start_date]:
        if start_time and end_time:
            return f"{start_time} - {end_time}"
        if start_time:
            return start_time
        if end_time:
            return f"Ends at {end_time}"
        return ""

    # datetimes because starts and ends on different dates
    if start_time:
        start_date = f"{start_date} {start_time}"
    if end_time:
        end_date = f"{end_date} {end_time}"

    return f"{start_date} - {end_date}" if end_date else ""
Пример #5
0
 def get_times(self):
     start_time = self.start_time
     if self.single_day_event and start_time:
         end_time = self.end_time
         if end_time:
             times = time(start_time) + "‑" + time(end_time)
         else:
             times = time(start_time)
         return times
Пример #6
0
def format_time(time_obj):
    if time_obj.hour == 12 and time_obj.minute == 0:
        return "midday"
    elif time_obj.hour == 0 and time_obj.minute == 0:
        return "midnight"
    elif time_obj.minute == 0:
        return time(time_obj, "gA").lower()
    else:
        return time(time_obj, "g.iA").lower()
Пример #7
0
    def appointment(self):
        """
            {start_date}, {start_time} Uhr, {name}, {location}, {rendezvous}
            {start_date}, {start_time} bis {end_time} Uhr, {name}, {location}, {rendezvous}
            {start_date}, {start_time} Uhr bis {end_date}, {end_time} Uhr, {name}, {location}, {rendezvous}
            {start_date}, {start_time} Uhr bis {end_date}, {name}, {location}, {rendezvous}
        """
        appointment = ''
        season_year = int(self.season.name)
        with_year = season_year != self.start_date.year or (
            self.end_date and season_year != self.end_date.year)
        y = 'Y' if with_year else ''
        start_date = date(self.start_date, "j.n." + y)
        end_date = date(self.end_date, "j.n." + y) if self.end_date else ''
        approximate = ''

        if self.start_time:
            if self.start_time.minute:
                start_time = time(self.start_time, "G.i")
            else:
                start_time = time(self.start_time, "G")
        elif self.approximate:
            start_time = ''
            approximate = self.approximate.name
        else:
            start_time = ''

        if self.end_time:
            if self.end_time.minute:
                end_time = time(self.end_time, "G.i")
            else:
                end_time = time(self.end_time, "G")
        else:
            end_time = ''

        if start_time:
            appointment = "{}, {}".format(start_date, start_time)
            if end_time:
                if end_date:
                    appointment = "{} Uhr bis {}, {} Uhr".format(
                        appointment, end_date, end_time)
                else:
                    appointment = "{} bis {} Uhr".format(appointment, end_time)
            else:
                appointment = "{} Uhr".format(appointment)
        if approximate:
            appointment = "{}, {}".format(start_date, approximate)
        if self.name:
            appointment = "{}, {}".format(appointment, self.name)
        if self.location:
            appointment = "{}, {}".format(appointment, self.location)
        if self.rendezvous:
            appointment = "{}, {}".format(appointment, self.rendezvous)
        return appointment
Пример #8
0
 def post(self, request, *args, **kwargs):
     tasks_qs = request.user.dayschedules.current_schedule.tasks.all()
     serialized_tasks = []
     for task_obj in tasks_qs:
         task_dict = {
             'id': task_obj.id,
             'startTime': defaultfilters.time(task_obj.start_time, 'H:i'),
             'endTime': defaultfilters.time(task_obj.end_time, 'H:i'),
             'desc': task_obj.task_desc,
             'completed': task_obj.completed,
         }
         serialized_tasks.append(task_dict)
     serialized_tasks.sort(key=lambda task: task['startTime'])
     return http.JsonResponse({'TASKS': serialized_tasks})
Пример #9
0
    def save(self, *args, **kwargs):
        translation.activate('en')

        if self.liff:
            with open(Path(settings.BASE_DIR) / 'liff' / 'static' / 'liff' / 'js' / 'json' / 'course.json') \
                    as json_file:
                self.info_flex_message = json.load(json_file)

                self.info_flex_message['body']['contents'][0][
                    'text'] = self.title_english
                self.info_flex_message['body']['contents'][1]['contents'][1][
                    'text'] = self.get_hole_display()
                self.info_flex_message['body']['contents'][2]['contents'][1][
                    'text'] = self.phone
                self.info_flex_message['body']['contents'][3]['contents'][1][
                    'text'] = self.fax
                self.info_flex_message['body']['contents'][4]['contents'][1][
                    'text'] = self.email
                self.info_flex_message['body']['contents'][5]['contents'][1]['text'] \
                    = '{} - {}'.format(time(self.business_hour_start, 'H:i'),
                                       time(self.business_hour_end, 'H:i'))

                if 'scorecard' in self.liff:
                    self.info_flex_message['body']['contents'][6]['contents'][4]['action']['uri'] \
                        = f"https://liff.line.me/{self.liff['scorecard']['en']['id']}"
                else:
                    self.info_flex_message['body']['contents'][6]['contents'][4]['action']['uri'] \
                        = f"https://liff.line.me/"

                if 'settings' in self.liff:
                    self.info_flex_message['body']['contents'][8]['contents'][0]['action']['uri'] \
                        = f"https://liff.line.me/{self.liff['settings']['en']['id']}"
                else:
                    self.info_flex_message['body']['contents'][8]['contents'][0]['action']['uri'] \
                        = f"https://liff.line.me/"

        with open(Path(settings.BASE_DIR) / 'liff' / 'static' / 'liff' / 'js' / 'json' / 'order.json') \
                as json_file:
            self.order_flex_message = json.load(json_file)

        with open(Path(settings.BASE_DIR) / 'liff' / 'static' / 'liff' / 'js' / 'json' / 'no-order.json') \
                as json_file:
            self.no_order_flex_message = json.load(json_file)

        translation.deactivate()

        state = super(GolfClub, self).save(*args, **kwargs)

        return state
Пример #10
0
    def long_date(self, with_year=False, with_time=False):
        """
        :param with_year: False

        5. September
        22. bis 25. Januar
        28. Mai bis 3. Juni
        30. Dezember 2016 bis 6. Januar 2017

        :param with_year: True

        5. September 2016
        22. bis 25. Januar 2016
        28. Mai bis 3. Juni 2016
        30. Dezember 2016 bis 6. Januar 2017

        :return: long formatted date
        """

        y = ' Y' if with_year else ''
        if self.end_date is None or self.start_date == self.end_date:
            value = date(self.start_date, "j. F" + y)
            if with_time and self.start_time:
                if self.end_time is None or self.start_time == self.end_time:
                    if self.start_time.minute:
                        if self.start_time.minute < 10:
                            minute = time(self.start_time, "i")[1:]
                        else:
                            minute = time(self.start_time, "i")
                        value = "{}, {}.{}".format(value,
                                                   time(self.start_time, "G"),
                                                   minute)
                    else:
                        value = "{}, {}".format(value,
                                                time(self.start_time, "G"))
                else:
                    if self.end_time.minute:
                        if self.start_time.minute < 10:
                            minute = time(self.start_time, "i")[1:]
                        else:
                            minute = time(self.start_time, "i")
                        value = "{}, {}.{}".format(value,
                                                   time(self.start_time, "G"),
                                                   minute)
                    else:
                        value = "{} bis {}".format(value,
                                                   time(self.start_time, "G"))
                value = "{} Uhr".format(value)
            return value
        elif self.start_date.month == self.end_date.month and self.start_date.year == self.end_date.year:
            return "{0} bis {1}".format(date(self.start_date, "j."),
                                        date(self.end_date, "j. F" + y))
        elif self.start_date.month != self.end_date.month:
            y0 = ''
            if self.start_date.year != self.end_date.year:
                y0 = y = ' Y'
            return "{0} bis {1}".format(date(self.start_date, "j. F" + y0),
                                        date(self.end_date, "j. F" + y))
Пример #11
0
 def __init__(self, *args, **kwargs):
     super(UserProfileForm, self).__init__(*args, **kwargs)
     now = timezone.localtime(timezone.now())
     self.fields['timezone'].help_text = _('Current time is: %(date)s %(time)s') % {
         'date': defaultfilters.date(now),
         'time': defaultfilters.time(now)
     }
Пример #12
0
    def test_job_detail_view_extension(self):
        job_id = self.queue.get_jobs()[0].id
        response = self.client.get(
            reverse('rq_job_detail',
                    kwargs={
                        'queue_index': 0,
                        'job_id': job_id
                    }))
        self.assertEqual(response.status_code, 200)
        self.assertTemplateUsed(response,
                                'django_rq/templates/job_detail.html')
        self.assertContains(
            response, "%s, %s" % (date(datetime.now()), time(datetime.now())))

        response = self.client.get(
            reverse('rq_job_detail',
                    kwargs={
                        'queue_index': 0,
                        'job_id': "fake"
                    }))
        self.assertEqual(response.status_code, 404)

        response = self.client.get(
            reverse('rq_job_detail',
                    kwargs={
                        'queue_index': 0,
                        'job_id': "empty"
                    }))
        self.assertEqual(response.status_code, 200)
Пример #13
0
 def __str__(self):
     from django.template import defaultfilters
     start_date = defaultfilters.date(self.start, "SHORT_DATE_FORMAT")
     start_time = defaultfilters.time(self.start, "TIME_FORMAT")
     if self.user:
         return "%s (%s %s)" % (str(self.user), str(start_date), str(start_time))
     else:
         return "%s (%s %s)" % (str(self.caller_id), str(start_date), str(start_time))
Пример #14
0
def single_datetime(from_date, whole_day=True):
    if whole_day:
        return date(from_date, "DATE_FORMAT")
    else:
        return u"%s, %s" % (
            date(from_date, "DATE_FORMAT"),
            time(from_date, "TIME_FORMAT"),
        )
Пример #15
0
def danatime(value, arg='n/j/Y'):
    if not isinstance(value, date):  # datetime is a subclass of date
        return value

    now = datetime.now(utc if is_aware(value) else None)
    if value > now:
        return value

    delta = now - value
    if delta.days < 1:
        # Fewer than a 24 hours ago (potentially different days)
        if delta.seconds < 1:
            # Fewer than 1 seconds ago
            return _('now')
        elif delta.seconds < 60:
            # 1 or multiple seconds
            # \u00a0 is a nonbreaking space
            return ungettext('a second ago', '%(count)d\u00a0seconds ago',
                             delta.seconds) % {
                                 'count': delta.seconds
                             }
        elif delta.seconds // 60 < 60:
            # 1 or multiple minutes
            count = delta.seconds // 60
            return ungettext('a minute ago', '%(count)s\u00a0minutes ago',
                             count) % {
                                 'count': count
                             }
        elif delta.seconds // (60 * 60) <= 6:
            # 1 to 6 hours
            count = delta.seconds // (60 * 60)
            return ungettext('an hour ago', '%(count)d\u00a0hours ago',
                             count) % {
                                 'count': count
                             }
        elif value.date() == datetime.now().date():
            # 6 to 24 hours ago on the same day
            return defaultfilters.time(value)
        else:
            # 6 to 24 hours ago yesterday
            return _('%s yesterday') % defaultfilters.time(value)
    elif value.date().year == datetime.now().year:
        # Same year
        return defaultfilters.date(value, 'MONTH_DAY_FORMAT')
    return defaultfilters.date(value, arg)
    def test_jobs_view_extension(self):
        response = self.client.get(reverse('rq_jobs', kwargs={'queue_index': 0}))
        self.assertEqual(response.status_code, 200)
        self.assertTemplateUsed(response, 'django_rq/templates/jobs.html')
        self.assertContains(response, "%s, %s" % (date(datetime.now()), time(datetime.now())))

        self.queue.empty()
        response = self.client.get(reverse('rq_jobs', kwargs={'queue_index': 0}))
        self.assertEqual(response.status_code, 200)
Пример #17
0
def short_time_format(value):
    """Returns the value formatted as a short time format

    The SHORT_TIME_FORMAT is a custom format not available in the template
    """
    try:
        return time(value, SHORT_TIME_FORMAT)
    except Exception:
        return value
Пример #18
0
def html_list(list):
    ret = "<ul>"
    for file in list:
        ret += "<li><a href=\"" + file.get_absolute_url(
        ) + "\">" + file.filename + "</a><br />" + date(
            file.uploaded, "DATE_FORMAT") + " " + time(file.uploaded,
                                                       "TIME_FORMAT") + "</li>"
    ret += "</ul>"
    return ret
Пример #19
0
def format_active_list(list):
    ret = '<ul>'
    for debate in list:
        title, url, created = debate
        ret += '<li><a href="%s">%s</a><br />%s</li>' % (
            url, title,
            date(created, "DATE_FORMAT") + " " + time(created, "TIME_FORMAT"))
    ret += '</ul>'
    return ret
Пример #20
0
 def post(self, request, *args, **kwargs):
     filled_task_form = kernel_forms.TaskCreateForm(request.POST)
     filled_task_form.instance.schedule = request.user.dayschedules.current_schedule
     if filled_task_form.is_valid():
         saved_task = filled_task_form.save()
         return http.JsonResponse({
             'taskId':
             saved_task.id,
             'taskStartTime':
             defaultfilters.time(saved_task.start_time, 'H:i'),
             'taskEndTime':
             defaultfilters.time(saved_task.end_time, 'H:i'),
             'taskDesc':
             saved_task.task_desc,
         })
     else:
         return http.JsonResponse({'FORM_ERRORS': filled_task_form.errors},
                                  status=400)
Пример #21
0
def natural_time(value):
    """
    Returns a 'natural' representation of the given time.
    Formats similar to Facebook.
    Based on django.contrib.humanize.naturaltime
    
    If given time occurred today, prints 'x seconds/minutes/hours ago'
    If given time occurred yesterday, prints 'yesterday at xx:xx'
    If given time occurred more than 1 day ago, prints full date
    """
    if not isinstance(value, date):  # datetime is a subclass of date
        return value

    current_timezone = get_current_timezone()
    now = datetime.now(current_timezone)
    yesterday = now - timedelta(days=1)
    value = value.astimezone(current_timezone)  # localize timezone

    delta = now - value
    if value.date() == yesterday.date():
        return _('yesterday at %(time)s') % {
            'time': defaultfilters.time(value, 'TIME_FORMAT')
        }
    elif delta.days != 0:
        return defaultfilters.date(value, 'DATETIME_FORMAT')
    elif delta.seconds == 0:
        return _('now')
    elif delta.seconds < 60:
        return ungettext(
            # Translators: please keep a non-breaking space (U+00A0)
            # between count and time unit.
            'a second ago',
            '%(count)s seconds ago',
            delta.seconds) % {
                'count': delta.seconds
            }
    elif delta.seconds // 60 < 60:
        count = delta.seconds // 60
        return ungettext(
            # Translators: please keep a non-breaking space (U+00A0)
            # between count and time unit.
            'a minute ago',
            '%(count)s minutes ago',
            count) % {
                'count': count
            }
    else:
        count = delta.seconds // 60 // 60
        return ungettext(
            # Translators: please keep a non-breaking space (U+00A0)
            # between count and time unit.
            'an hour ago',
            '%(count)s hours ago',
            count) % {
                'count': count
            }
Пример #22
0
 def get_google_label(from_time, to_time):
     if interval_type.name == models.INTERVAL_ANNUALLY:
         return "%d" % from_time.year
     elif interval_type.name == models.INTERVAL_HOURLY:
         from django.template.defaultfilters import date, time
         return "%s %s-%s" % (date(
             to_time, "DATE_FORMAT").title(), time(
                 from_time, "TIME_FORMAT"), time(to_time, "TIME_FORMAT"))
     elif interval_type.name == models.INTERVAL_DAILY:
         from django.template.defaultfilters import date, time
         return "%s" % date(to_time, "DATE_FORMAT").title()
     elif interval_type.name == models.INTERVAL_WEEKLY:
         from django.template.defaultfilters import date, time
         return "%s - %s" % (date(from_time, "DATE_FORMAT").title(),
                             date(from_time, "DATE_FORMAT").title())
     elif interval_type.name == models.INTERVAL_MONTHLY:
         from django.template.defaultfilters import date, time
         return "%s" % date(from_time, "F Y").title()
     return None
Пример #23
0
def to_string_for_json(obj):
    # Convert date objects with Django's date filter
    if isinstance(obj, datetime.date):
        return date(obj)
    # Convert datetime objects with Django's time filter
    elif isinstance(obj, datetime.datetime):
        return time(obj)
    # Use ``repr()`` as the fallback serializer for unserializable objects
    else:
        return repr(obj)
Пример #24
0
 def test_tasks_retrieval(self):
     user = self.login_user()
     user.dayschedules.current_schedule.tasks.create(
         start_time=datetime.time(7, 0),
         end_time=datetime.time(8, 0),
         task_desc='Test task',
     )
     user.dayschedules.current_schedule.tasks.create(
         start_time=datetime.time(9, 0),
         end_time=datetime.time(10, 0),
         task_desc='Test task 1',
     )
     user.dayschedules.current_schedule.tasks.create(
         start_time=datetime.time(11, 0),
         end_time=datetime.time(12, 0),
         task_desc='Test task 2',
     )
     user.dayschedules.current_schedule.tasks.create(
         start_time=datetime.time(13, 0),
         end_time=datetime.time(14, 0),
         task_desc='Test task 3',
     )
     response = self.client.post(
         path=self.path,
         data={},
         HTTP_X_REQUESTED_WITH='XMLHttpRequest',
     )
     self.assertEqual(200, response.status_code)
     tasks_qs = user.dayschedules.current_schedule.tasks.all()
     serialized_tasks = []
     for task_obj in tasks_qs:
         task_dict = {
             'id': task_obj.id,
             'startTime': defaultfilters.time(task_obj.start_time, 'H:i'),
             'endTime': defaultfilters.time(task_obj.end_time, 'H:i'),
             'desc': task_obj.task_desc,
             'completed': task_obj.completed,
         }
         serialized_tasks.append(task_dict)
     serialized_tasks.sort(key=lambda task: task['startTime'])
     data = response.json()
     self.assertEqual(data['TASKS'], serialized_tasks)
Пример #25
0
def fancy_session_timing(session, skipdate=False):
    '''Display appropriate timing of session depending on context and available information'''

    timing = session.timing_start_planned

    if timing:
        return timing if not skipdate else time(timing)
    elif session.timing_text:
        return capfirst(session.timing_text)
    else:
        return ''
Пример #26
0
def fancy_committee_agenda_timing(agenda, skipdate=False):
    '''Display appropriate timing of committee agenda depending on context and available information'''

    timing = agenda.timing_start_planned

    if timing.time().isoformat() != '00:00:00':
        return timing if not skipdate else time(timing)
    elif agenda.timing_text:
        return '%s (%s)' % (date(timing), agenda.timing_text) if not skipdate else agenda.timing_text
    else:
        return date(timing) if not skipdate else ''
Пример #27
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     now = timezone.localtime(timezone.now())
     self.fields['timezone'].help_text = _('Current time is: %(date)s %(time)s') % {
         'date': defaultfilters.date(now),
         'time': defaultfilters.time(now)}
     self.fields['notify_when'].initial = self.instance.notify_when
     self.fields['notify_mentions'].initial = bool(
          self.instance.notify & Notify.MENTION)
     self.fields['notify_replies'].initial = bool(
         self.instance.notify & Notify.REPLY)
Пример #28
0
 def __str__(self):
     from django.template import defaultfilters
     date = defaultfilters.date(self.time, "SHORT_DATE_FORMAT")
     time = defaultfilters.time(self.time, "TIME_FORMAT")
     datetime = date + " " + time
     if self.visited_element:
         return "%s: @ %s -> %s" % (str(self.session), str(datetime), str(self.visited_element))
     elif self.description:
         return "%s: @ %s -> %s" % (str(self.session), str(datetime), str(self.description))
     else:
         return "%s: @ %s" % (str(self.session), str(datetime))
Пример #29
0
    def departure(self):
        """
            {start_date}, {start_time}, {rendezvous}, Heimkehr am {end_date} gegen {end_time} Uhr
        """
        season_year = int(self.season.name)
        with_year = season_year != self.start_date.year or (
            self.end_date and season_year != self.end_date.year)
        y = 'Y' if with_year else ''
        start_date = date(self.start_date, "j.n." + y)

        if self.start_time:
            if self.start_time.minute:
                start_time = time(self.start_time, "G.i")
            else:
                start_time = time(self.start_time, "G")
            start_time = "{} Uhr".format(start_time)
        else:
            start_time = self.approximate.name if self.approximate else ''

        if self.end_date and self.end_date != self.start_date:
            end_date = date(self.end_date, "j.n." + y)
        else:
            end_date = ''

        if self.end_time:
            if self.end_time.minute:
                end_time = time(self.end_time, "G.i")
            else:
                end_time = time(self.end_time, "G")
        else:
            end_time = ''

        departure = "{}, {}".format(start_date, start_time)
        if self.rendezvous:
            departure = "{}, {}".format(departure, self.rendezvous)
        if end_time:
            departure = "{}, Heimkehr".format(departure)
            if end_date:
                departure = "{} am {}".format(departure, end_date)
            departure = "{} gegen {} Uhr".format(departure, end_time)
        return departure
Пример #30
0
 def __init__(self, *args, **kwargs):
     super(UserProfileForm, self).__init__(*args, **kwargs)
     now = timezone.localtime(timezone.now())
     self.fields['timezone'].help_text = _(
         'Current time is: %(date)s %(time)s') % {
             'date': defaultfilters.date(now),
             'time': defaultfilters.time(now)
         }
     self.fields['email_send'] = forms.ChoiceField(
         choices=SEND_CHOICES,
         widget=forms.RadioSelect(),
         label='Email send')