O'Reilly logo

Professional Plone Development: Building robust, content-centric web applications with Plone 3, an open source Content Management System by Martin Aspeli

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding the User Interface

All that remains now is to add the view code that uses these utilities to present information to the user. Before trying to access any of the updated views through the Web, do not forget to go to Site Settings and configure the database using our new control panel.

Updating the Film and Cinema Views

The changes to browser/film.py and browser/film.pt are simple. In the FilmView class:

@memoize
def cinemas(self, days=14):
    context = aq_inner(self.context)
    locator = getUtility(IScreeningLocator)
    from_date = datetime.now()
    to_date = from_date + timedelta(days)
    return locator.cinemas_for_film(context, from_date, to_date)

And in the template:

<h2 i18n:translate="title_film_showing_at">Now showing at</h2> <dl> <tal:block repeat="cinema ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required