Painting Web Applications

Adding Attributes

The DVD class certainly doesn't have much character about it, does it? You'll make it much more interesting by adding attributes to the class that capture the characteristics of a DVD. Just like in the last article, the attributes will include a DVD number (so you can find it on the shelf), a running time (in minutes), a rating (so you can keep your kids from seeing Grindhouse until they're 17, for example), and a selection of genres to which the movie belongs.

To add an attribute, click the Properties section at the bottom of the window and then click the "New Attribute" button, as shown below:

For the first attribute, enter the name dvdNumber and leave the data type as int. Then, click the Tagged Values section and annotate this attribute with the values shown below:

You're done with the DVD class! In your UML tool, you should have a single class that looks something like this:

Wait! There's no "title" attribute! Where do you place the name of the movie? As with the last article, the title attribute comes automatically. You don't have to put one in manually. Just about every object in Plone has a title of some sort.

Advertiser Disclosure:
Some of the products that appear on this site are from companies from which QuinStreet receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. QuinStreet does not include all companies or all types of products available in the marketplace.

Thanks for your registration, follow us on our social networks to keep up-to-date