예제 #1
0
def newsarticle(request, newsarticle):
    return OrderedDict([
        ('id', newsarticle.pk),
        ('title', newsarticle.title),
        ('date_published', unix_time(newsarticle.publication_date)),
        ('html_article_text', newsarticle.html_article_text),
        ('image', image_url_or_missing(request, newsarticle.image)),
    ])
예제 #2
0
def event(request, event):
    tags = tags_mappings(event.tags.all())
    signup_link = event.external_signup_url if event.external_signup_url else absolute_url(request, '/fairs/2017/events/' + str(
        event.pk) + '/signup')
    return OrderedDict([
                           ('id', event.pk),
                           ('name', event.name),
                           ('image_url', image_url_or_missing(request, event.image_original)),
                           ('location', event.location),
                           ('description_short', event.description_short),
                           ('description', event.description),
                           ('signup_link', signup_link),
                           ('event_start', unix_time(event.event_start)),
                           ('event_end', unix_time(event.event_end)),
                           ('registration_required', event.registration_required),
                           ('registration_start', unix_time(event.registration_start)),
                           ('registration_end', unix_time(event.registration_end)),
                           ('registration_last_day_cancel',
                            unix_time(event.registration_last_day_cancel)),
                       ] + tags)