Exemplo n.º 1
0
def story_list():
    """List of stories.

    The '_story_list.html' template can be found in the ftp folder.

    """
    current_site = Site.objects.get_current()
    home_body = get_home_body()
    return dict(
        story_list=Story.objects.published(
            home_body,
        ).filter(
            site__id__exact=current_site.pk,
        ).order_by(
            '-story_date'
        ),
    )
Exemplo n.º 2
0
def event_list():
    """List of events.

    The '_event_list.html' template can be found in the ftp folder.

    """
    current_site = Site.objects.get_current()
    home_body = get_home_body()
    return dict(
        event_list=Event.objects.published(
            home_body,
        ).filter(
            event_date__gte=date.today(),
            site__id__exact=current_site.pk,
        ).order_by(
            'event_date',
            'event_time',
        ),
    )
Exemplo n.º 3
0
def default_scenario_pump():
    default_page_section()
    default_block_state()
    default_site()
    # story
    make_story(
        make_story_block(get_home_body()),
        get_site_hatherleigh(),
        order=1,
        story_date=datetime.today(),
        user=get_user_staff(),
        title='MGs descend on Hatherleigh',
        description=(
            "The Taw and Torridge MG owners club came to Hatherleigh, on "
            "Tuesday, to join the crowds at Hatherleigh Market. They came "
            "to visit Martin at the Hatherleigh Fish Bar. Martin the owner "
            "of the bar also has two MGs."
        )
    )
    make_story(
        make_story_block(get_home_body()),
        get_site_hatherleigh(),
        order=2,
        story_date=datetime.today(),
        user=get_user_web(),
        title='Market Offices burnt down',
        description=(
            "The market offices burnt down last night. I am sure theories "
            "will abound around the town, but we will have to wait until the "
            "Police have done their bit, before we will know. The offices "
            "and files held within seam to have been totalled destroyed. "
            "Tomorrow's Market should go ahead although the auction will "
            "NOT take place, but the stallholders hopefully will be selling "
            "their wares"
        )
    )
    make_story(
        make_story_block(get_home_body()),
        get_site_hatherleigh(),
        order=3,
        story_date=datetime.today(),
        name='Pat',
        email='*****@*****.**',
        title='Craft Fair',
        description=(
            "Over 200 entries were exhibited at the Hatherleigh Craft Show, "
            "at its launch in Hatherleigh Community Centre on Sunday 4th "
            "August. Judges had the difficult task of awarding rosettes for "
            "1st, 2nd & 3rd places in each of the 24 classes, ranging from "
            "knitting to metal work."
        )
    )
    story_block = make_story_block(get_home_body())
    story_date = datetime.now() + relativedelta(months=-1, day=7)
    make_story(
        story_block,
        get_site_hatherleigh(),
        order=4,
        story_date=story_date,
        name='Pat',
        email='*****@*****.**',
        title='The Market Planning has been Approved',
        description=(
            "I had an eye opening experience, last week, that left me "
            "ashamed of our democracy. The paid planners of the council, "
            "recommended that the outline planning application for "
            "Hatherleigh Market be approved as presented by the paid "
            "consultants."
        )
    )
    story_block.publish(get_user_staff())
    story_block = make_story_block(get_home_body())
    story_date = datetime.now() + relativedelta(months=2, day=7)
    make_story(
        story_block,
        get_site_exbourne_and_jacobstowe(),
        order=5,
        story_date=story_date,
        user=get_user_web(),
        title='Wind Turbines',
        description=(
            "The turbine will be 50 meters high and will affect the view "
            "from Exbourne and Jacobstowe"
        )
    )
    story_block.publish(get_user_staff())
    # event
    event_date = date.today() + relativedelta(days=8)
    make_event(
        make_event_block(get_home_body()),
        get_site_exbourne_and_jacobstowe(),
        order=1,
        user=get_user_web(),
        title='Free Microchipping for Dogs',
        event_date=event_date,
        event_time=time(19, 30),
        description=(
            "Free Microchipping The law is changing! As from the 6th April "
            "2016 you must have your dog microchipped - please visit us at "
            "At The Burrow Cafe, Exbourne on Friday 7th February, between "
            "10am - 12noon, from the Dogs Trust & West Devon Borough Council "
            "Customer Service Advisor to help with all your council and many "
            "public service enquiries Everyone Welcome"
        )
    )
    event_date = date.today() + relativedelta(days=4)
    make_event(
        make_event_block(get_home_body()),
        get_site_hatherleigh(),
        order=2,
        name='Pat',
        email='*****@*****.**',
        title='History Society',
        event_date=event_date,
        event_time=time(19, 30),
        description=(
            "On Monday February 10th at 7:30pm in Old Schools Dr. Janet Few "
            "will be giving an illustrated talk entitled ‘Farm, Fish, Faith "
            "and Family’. As usual all are welcome (non-members £2) The "
            "History Society is currently investigating Hatherleigh’s "
            "prehistoric history and is keen to hear of any finds relating "
            "to this period in particular worked flints such as the one "
            "recently found by a pupil at the School."
        )
    )
    event_date = date.today()
    make_event(
        make_event_block(get_home_body()),
        get_site_hatherleigh(),
        order=3,
        name='Pat',
        email='*****@*****.**',
        title='Temp Title Today',
        event_date=event_date,
        event_time=time(19, 30),
        description=(
            "Temp Description for Today"
        )
    )
    event_date = date.today() + relativedelta(days=-5)
    make_event(
        make_event_block(get_home_body()),
        get_site_hatherleigh(),
        order=4,
        name='Pat',
        email='*****@*****.**',
        title='Temp Title',
        event_date=event_date,
        event_time=time(19, 30),
        description=(
            "Temp Description"
        )
    )
    event_date = date.today() + relativedelta(days=10)
    make_event(
        make_event_block(get_home_body()),
        get_site_hatherleigh(),
        order=5,
        user=get_user_web(),
        title='Gardening Trip',
        event_date=event_date,
        event_time=time(15, 00),
        description=(
            "We are off to Cornwall to visit two very different gardens in "
            "and near Truro: Bosvigo House and Ladock House."
        )
    )
Exemplo n.º 4
0
 def get_queryset(self):
     home_body = get_home_body()
     return Story.objects.published(home_body)