def news_and_events(context, display="news-and-events", heading=3, format="details", current_or_archive="current", max_items=None, order_by="importance/date", entity=None): """ Depends on Cardiff's row/column CSS Publishes a date-ordered list of news and events """ instance = NewsAndEventsPlugin() if not entity: entity = work_out_entity(context, entity) instance.order_by = order_by instance.entity = entity instance.heading_level = heading instance.display = display instance.limit_to = max_items instance.format = format instance.layout = "sidebyside" instance.current_or_archive = current_or_archive instance.show_more_items = False # because we know that these hardcoded lists don't require it CMSNewsAndEventsPlugin().render(context, instance, None) return context
def common_settings(request, slug): # general values - entity, request, template entity = Entity.objects.get(slug=slug) or default_entity request.current_page = entity.get_website() # for the menu, so it knows where we are context = RequestContext(request) instance = NewsAndEventsPlugin() instance.limit_to = MAIN_NEWS_EVENTS_PAGE_LIST_LENGTH instance.default_limit = MAIN_NEWS_EVENTS_PAGE_LIST_LENGTH instance.order_by = "importance/date" instance.entity = entity instance.heading_level = IN_BODY_HEADING_LEVEL instance.display = "news-and-events" instance.format = "details image" instance.layout = layout instance.view = "current" return instance, context, entity
def person_events(context): """ Depends on Cardiff's row/column CSS Publishes a date-ordered list of news and events """ instance = NewsAndEventsPlugin() instance.type = "for_person" instance.heading_level = 3 instance.display = "events" instance.view = "all_forthcoming" instance.order_by = "date" instance.format = "details" instance.show_images = False instance.person = context["person"] # get_news_and_events(instance) CMSNewsAndEventsPlugin().render(context, instance, None) return context
def person_events(context): """ Depends on Cardiff's row/column CSS Publishes a date-ordered list of news and events """ instance = NewsAndEventsPlugin() instance.type = "for_person" instance.heading_level = 3 instance.display = "events" instance.view = "all_forthcoming" instance.order_by = "date" instance.format = "details" instance.show_images = False instance.person = context["person"] # get_news_and_events(instance) CMSNewsAndEventsPlugin().render(context, instance, None) return context
def common_settings(request, slug = default_entity.slug): # general values - entity, request, template entity = Entity.objects.get(slug=slug) # request.current_page = entity.get_website() # for the menu, so it knows where we are request.current_page = default_entity.get_website() context = RequestContext(request) instance = NewsAndEventsPlugin() instance.limit_to = news_and_events_list_default_limit instance.default_limit = news_and_events_list_default_limit instance.order_by = "importance/date" instance.entity = entity instance.heading_level = h_main_body instance.display = "news-and-events" instance.format = "details" instance.layout = "sidebyside" instance.view = "current" return instance, context, entity
def place_events(context): """ Depends on Cardiff's row/column CSS Publishes a date-ordered list of news and events """ instance = NewsAndEventsPlugin() instance.type = "for_place" instance.display = "events" instance.view = "current" instance.order_by = "date" instance.format = "details" instance.show_images = False instance.limit_to = None instance.show_venue = False instance.place = context["place"] # get_news_and_events(instance) CMSNewsAndEventsPlugin().render(context, instance, None) return context
def place_events(context): """ Depends on Cardiff's row/column CSS Publishes a date-ordered list of news and events """ instance = NewsAndEventsPlugin() instance.type = "for_place" instance.display = "events" instance.view = "current" instance.order_by = "date" instance.format = "details" instance.show_images = False instance.limit_to = None instance.show_venue = False instance.place = context["place"] # get_news_and_events(instance) CMSNewsAndEventsPlugin().render(context, instance, None) return context
def events(self): from news_and_events.models import NewsAndEventsPlugin # invoke the plugin to find out more instance = NewsAndEventsPlugin() instance.display = "events" instance.type = "for_place" instance.place = self instance.view = "current" instance.format = "details image" # create an instance of the plugin to see if the menu should have items plugin = CMSNewsAndEventsPlugin() plugin.get_items(instance) plugin.add_links_to_other_items(instance) plugin.set_image_format(instance) plugin.set_limits_and_indexes(instance) instance.lists = plugin.lists return instance
def news_and_events(context, display="news-and-events", heading=3, format="details", current_or_archive="current", max_items=None, order_by="importance/date", entity=None): """ Depends on Cardiff's row/column CSS Publishes a date-ordered list of news and events """ instance = NewsAndEventsPlugin() if not entity: entity = work_out_entity(context, entity) instance.order_by = order_by instance.entity = entity instance.heading_level = heading instance.display = display instance.limit_to = max_items instance.format = format instance.layout = "sidebyside" instance.current_or_archive = current_or_archive instance.show_more_items = False # because we know that these hardcoded lists don't require it CMSNewsAndEventsPlugin().render(context, instance, None) return context