TTW Content Types Demo
CC Attribution 3.0 Germany:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor.
Casali, Fulvio
A demonstration of creating new content types through the web using the Dexterity content types framework in Plone.
 Hello everyone, welcome and thanks for the reminder. My name is Fulvio Kazali, I'm not Calvin. He, I'm taking his place because I actually assisted and helped and taught some of the trainings in the past few days, in particular the one that we're going to talk about now, so might as well just do it again. And, oh I should plug in here. And we, all presenters were asked to put that slide that Christie showed you at the very end and I forgot so I'm doing it at the beginning. Please go, please after this presentation, please go to plonekonf.sixfeedup.com to give your feedback. So again my name is Fulvio Kazali and I have been a plon developer for eight years from Seattle, Washington. And I'm here to talk about dexterity, creating content types for plon through the web as a follow on to Chris's talks, steaming through the web. And this, I just want to give a bit of a shout out to this effort that has been in, in, in progress for the last couple of years where we finally got, got to the point where we have excellent documentation for plon which has been sorely missing for years. And at the same time also trainings. Philip Bauer and his colleagues started writing a, writing and offering a training curriculum for plon in Germany and basically open, publishing it open as open source for anybody to use and that has led to a compliment to our documentation for, for people to use and to learn about plon and at the past, well last year in Bucharest I also gave one of these trainings and, and this, this effort has been really taking off and so a lot of people have been contributing and, and, and improving this documentation and it's now getting really good. And, and one thing that we've heard was okay great now we have documentation but it would be great to have video also, video, video trainings and so this is what this, what this talk is because it's being recorded and so it's sort of like a short, a condensed version of what we did in the past two days of some of the topics that we covered in the past, past few days and so hopefully we're going to start building a library of video trainings and they, no doubt they will be replaced and improved but this is just the first shot and so down at the bottom right this, this cycle of, of trainings is about through the web and in particular we're talking about dexterity and creating content types. What, what do we mean by content types and because this is being recorded and anybody could be watching it I'm going to give an analogy that a lot of people are probably familiar with working with other content management systems or, or other web frameworks and that is you know the, the relational database type of idea where if you, if you think of a table in a relational, relational database you have a bunch of columns and, and each record, each row in the table is a record that has different values in each of the columns and, and the, the, the number and the types of columns in this table is the schema for the table and that is sort of what we mean by content types in Plone. It's we're, we're, we're thinking of a particular, a particular unit of content that has certain fields that have certain attributes and, and all of the, the, the content items in our website that were created with this schema have the same fields. I should say also that Plone does not use a relational database in the back end so this is just an analogy, it's not actually how it works behind the scenes but it's, I think it's a good analogy. So for, for definitions the, the schema is, as I mentioned is the type, sort of the, the, the set of columns in our, in our table in other words what the fields are that we want for our, for our objects. However, that's not all because we also want a few other bits of metadata that describe our, our content type and that is what we call, in Plone we call the factory type information, the FTI which, which includes things like the name, the icon that we'll see when we create or when we look for data content items in the, in our website and also what views are available for this particular content type. So what is a view? A view is the, the representation of this object and it can be visual, it can be a JSON data structure, it can be an XML serialization of that type, that data, it's just how you, depending on how you're going to use it, you can, you can have different views. There's also a view view and an edit view for example, if you, when you, when you're, when you have the permission to actually change this, this data, data element you can go in and edit it and then you see the, the field widgets. Now in Plone, the, the, the content type framework that we use is called dexterity. But this is, this is like the, the latest iteration of content type frameworks. In past versions of Plones we, Plone we used something called archetypes and it's now, it's now being replaced by dexterity. It's obviously we thought the, the community thought that it needed to be improved so it got replaced with dexterity. The main difference and, and the main, the whole point of this, this, this presentation is that, or one important difference is that in dexterity you can actually create the fine content types through your web browser. You don't have to write Python code to, to, to, to, to, before you can actually use your content types. And there are other differences that happen under the, under the cover that I'm not going to go into. So when you are logged into a Plone site, the first place, the, the most common, the most frequent place where you run into content types is the add new menu. Here are all of the content types that are, that come out of the box with a, with a brand new Plone site. So the most common one that you're going to use is the page. This, the home page is an example of a page content type. There are others like a news item, an event that has start and end dates, participants, location and other information that is useful to have for an event, a folder which is just a content for other, a container for other content types and so on. But we are actually interested in defining something new, something that's not on here yet. And if you've seen Eric's keynote earlier, he actually went through the same exercise that I'm going through now, he created a recipe content type. I'm going to create something else. I'm going to create a, so basically I'm, the assumption here, the premise is that this website is for, for, for, is the, is the website for a conference and a lot of the content in this website is going to be pages about talks, about presentations. So I'm going to create a content type called talk. And I find the, the control panel for creating, creating and, and viewing and editing content types in the dexterity content type control panel. And here you see the default types already. So you can actually, actually already just go in here and change the default content types, which I actually do with, for my clients a lot of times. I go in and add some fields that they want for pages or for news items or for what not. But here, now I'm actually going to create a new one. So this is going to be called talk and I've created it. And now I'm going to give it some fields. So I go to the fields tab and we can see that it already has a couple of fields that come sort of out of the box from what we call behaviors. We can also remove them if we want to, but for now we're just going to not worry about those and add a new one. So I'm going to call this field the presenter and fields have just like columns in a database table have type, a type. So here are choices for all of the types that we can use right out of the box. In this case, it's just going to be a string. So it's a text line. And let's make it required because every presentation will need at least a presenter. And there it is. Now I can go into the settings link and change some of the attributes of this field. For example, I can make it not required if I want. I can give it a minimum or a maximum length. And these attributes depend on the type of field that you're going to be using. Let's add another field. Let's say type of presentation. And this one is going to be a choice. So it's basically a pick list where now I have to go into the settings because right now it has no values. So I'm going to give it some values. So it could be a keynote or it could be a training or it could be a talk. And now already you see here the values, the allowed values that I gave it. So already we can use this, go back to the home page, go to the add new menu and there is our new type. And if I create a new one, I see the title and the summary as we've seen. Those were already there. And here is the presenter which is required as denoted by the red dot and the type of presentation. And because it's required, if I move the mouse out of it, it's telling me, hey, you forgot to put something in there. So let's actually, I'm going to put my name in here. And I'm going to say this is a talk. Save it. Oh, of course, I forgot the title. Save it. Should always give it a summary for search ability. It's very important. But I am cheating right now. And here it is. And I can also see it in the contents of my website. No? Oh. There. There it is. And it inherits all of the functionality that other content types have. For example, I can publish it either through this menu, state, or through the state's menu that's in the toolbar. I could do that as well. I'm just going to do it through here. And there we go. So I created a content type, and I created my first item of the talk content type. Before I go, I just want to mention a couple of other things. So Dexterity allows you to do this through the web, through a browser, but you don't have to. You can do something through code in an add-on that you create, that you instantiate with Mr. Bob, and then you put it in your GitHub repository and all that, all those common development practices. But you can also move back and forth between through the web and through code. So for example, I can, and this, so actually I could, for example, I could write a new type. Right now I'm working on my local host on this machine, but I could just now move this type to a production website by saying I check the box here, and then I say export type profiles. And this is basically the FTI definition that I mentioned earlier. It gives me a zip file that I downloaded on my local hard disk. And now, actually let me do this. So all right, let's look at it. So now I've unzipped it. And actually I'm just going to drag this into my text editor. I'm not going to do it. Just, okay, well, let's do it. All right. So here at the root of this zip file, there is a, this is a generic setup profile import step XML file definition. And in the folder that has the name of the content type, there is the FTI XML definition. And it also contains the entire XML schema definition that is now encoded, so it looks really ugly, but it's there. And if I go back to, let's say now I'm creating a new site. Now this is a brand new site I just created. There are no talks, but I can go to the dexterity control panel and click the import type profiles, browse to the file, where am I? Browse to the zip file that I just downloaded from the other site. And there's my talk. And there it is. I create, I can't create it. I think that's all the time I have. And I did not forget. So please go to submit your feedback at plonkopf.sixfeedup.com. And thank you for coming. And do you have any questions? What's the difference between those two export options? Oh, there were two export options. Okay. So we exported the type profile. The schema model, I'll show you what it is by going here. That's what that is. That button would give you this XML file. And this is the schema description. See it has the presenter, which is a text line. It has the type of presentation, which is a choice. And there are the choices. So that's the entire schema definition of my content type. The use case for this is that I can actually go in here and change it. This is an editor. This is a text editor. I can make changes to, I can say, required true, for example. Save it. And this change is immediately applied to the content type on my website. I can also download it from the main dexterity control panel here. I can export it. And I do it. And are there like model options that aren't available here? Yes. Can you find yourself going to that sometimes? Because it's the only way to do it. Yes, I do. For example, one thing that you can't do, there are many things you can't do through the browser. So you will hit a ceiling pretty quickly. But one example is some fields, you want them to be available only to site administrators and not to editors. And so those permissions you cannot do through yet through the browser. You have to actually, but you can do them just by editing the XML schema. Yes? Can you easily add an icon for that new desktop? That is unfortunately not yet. So you've noticed, you've noticed, add new. Everything has an icon. The talk does not. Sorry. Yeah. Although, maybe, I haven't tried it. It's possible. Can you have behavior? Yes. Oh, behavior is a whole other topic. But yes, yes, yes, yes. That's in fact, that's one of the main use cases. There is this tab behaviors. So there we looked at the fields. We added some fields. And there's this other tab behaviors that has a lot of behaviors that are really, really useful and important. In fact, that's, most of the time, that's what I do. I don't actually add fields. I just turn on and off behaviors for content types because it just gives me a whole lot of things at once that I don't have to, nothing else to do. Yeah. If you take an existing content type like events, and if you add something, take an upload field because I tried this, an upload field, and then you create a new event. Because I remember that new field doesn't show up. Am I wrong? It should show up. It depends. It should show up. It may be that it ended up in a different field set. So for example, here, these are field sets that we get just from behaviors by default and we can turn off. And sometimes people create field sets by mistake instead of fields. And then they add, so. Okay. When you're done, could I come up and try it? Sure. Sure. All right. Thank you very much. Thank you. Thank you. Thank you. Thank you. Thank you.
 Hello everyone, welcome and thanks for the reminder.  My name is Fulvio Kazali, I'm not Calvin.  He, I'm taking his place because I actually assisted and helped and taught some of the  trainings in the past few days, in particular the one that we're going to talk about now,  so might as well just do it again.  And, oh I should plug in here.  And we, all presenters were asked to put that slide that Christie showed you at the very  end and I forgot so I'm doing it at the beginning.  Please go, please after this presentation, please go to plonekonf.sixfeedup.com to give  your feedback.  So again my name is Fulvio Kazali and I have been a plon developer for eight years from  Seattle, Washington.  And I'm here to talk about dexterity, creating content types for plon through the web as  a follow on to Chris's talks, steaming through the web.  And this, I just want to give a bit of a shout out to this effort that has been in, in, in  progress for the last couple of years where we finally got, got to the point where we  have excellent documentation for plon which has been sorely missing for years.  And at the same time also trainings.  Philip Bauer and his colleagues started writing a, writing and offering a training curriculum  for plon in Germany and basically open, publishing it open as open source for anybody to use  and that has led to a compliment to our documentation for, for people to use and to learn about  plon and at the past, well last year in Bucharest I also gave one of these trainings and, and  this, this effort has been really taking off and so a lot of people have been contributing  and, and, and improving this documentation and it's now getting really good.  And, and one thing that we've heard was okay great now we have documentation but it would  be great to have video also, video, video trainings and so this is what this, what this  talk is because it's being recorded and so it's sort of like a short, a condensed version  of what we did in the past two days of some of the topics that we covered in the past,  past few days and so hopefully we're going to start building a library of video trainings  and they, no doubt they will be replaced and improved but this is just the first shot and  so down at the bottom right this, this cycle of, of trainings is about through the web  and in particular we're talking about dexterity and creating content types.  What, what do we mean by content types and because this is being recorded and anybody  could be watching it I'm going to give an analogy that a lot of people are probably  familiar with working with other content management systems or, or other web frameworks and that  is you know the, the relational database type of idea where if you, if you think of a table  in a relational, relational database you have a bunch of columns and, and each record, each  row in the table is a record that has different values in each of the columns and, and the,  the, the number and the types of columns in this table is the schema for the table and  that is sort of what we mean by content types in Plone.  It's we're, we're, we're thinking of a particular, a particular unit of content that has certain  fields that have certain attributes and, and all of the, the, the content items in our  website that were created with this schema have the same fields.  I should say also that Plone does not use a relational database in the back end so this  is just an analogy, it's not actually how it works behind the scenes but it's, I think  it's a good analogy.  So for, for definitions the, the schema is, as I mentioned is the type, sort of the, the,  the set of columns in our, in our table in other words what the fields are that we want  for our, for our objects.  However, that's not all because we also want a few other bits of metadata that describe  our, our content type and that is what we call, in Plone we call the factory type information,  the FTI which, which includes things like the name, the icon that we'll see when we  create or when we look for data content items in the, in our website and also what views  are available for this particular content type.  So what is a view?  A view is the, the representation of this object and it can be visual, it can be a JSON  data structure, it can be an XML serialization of that type, that data, it's just how you,  depending on how you're going to use it, you can, you can have different views.  There's also a view view and an edit view for example, if you, when you, when you're,  when you have the permission to actually change this, this data, data element you can go in  and edit it and then you see the, the field widgets.  Now in Plone, the, the, the content type framework that we use is called dexterity.  But this is, this is like the, the latest iteration of content type frameworks.  In past versions of Plones we, Plone we used something called archetypes and it's now,  it's now being replaced by dexterity.  It's obviously we thought the, the community thought that it needed to be improved so it  got replaced with dexterity.  The main difference and, and the main, the whole point of this, this, this presentation  is that, or one important difference is that in dexterity you can actually create the fine  content types through your web browser.  You don't have to write Python code to, to, to, to, to, before you can actually use your  content types.  And there are other differences that happen under the, under the cover that I'm not going  to go into.  So when you are logged into a Plone site, the first place, the, the most common, the  most frequent place where you run into content types is the add new menu.  Here are all of the content types that are, that come out of the box with a, with a brand  new Plone site.  So the most common one that you're going to use is the page.  This, the home page is an example of a page content type.  There are others like a news item, an event that has start and end dates, participants,  location and other information that is useful to have for an event, a folder which is just  a content for other, a container for other content types and so on.  But we are actually interested in defining something new, something that's not on here  yet.  And if you've seen Eric's keynote earlier, he actually went through the same exercise  that I'm going through now, he created a recipe content type.  I'm going to create something else.  I'm going to create a, so basically I'm, the assumption here, the premise is that this  website is for, for, for, is the, is the website for a conference and a lot of the content  in this website is going to be pages about talks, about presentations.  So I'm going to create a content type called talk.  And I find the, the control panel for creating, creating and, and viewing and editing content  types in the dexterity content type control panel.  And here you see the default types already.  So you can actually, actually already just go in here and change the default content  types, which I actually do with, for my clients a lot of times.  I go in and add some fields that they want for pages or for news items or for what not.  But here, now I'm actually going to create a new one.  So this is going to be called talk and I've created it.  And now I'm going to give it some fields.  So I go to the fields tab and we can see that it already has a couple of fields that come  sort of out of the box from what we call behaviors.  We can also remove them if we want to, but for now we're just going to not worry about  those and add a new one.  So I'm going to call this field the presenter and fields have just like columns in a database  table have type, a type.  So here are choices for all of the types that we can use right out of the box.  In this case, it's just going to be a string.  So it's a text line.  And let's make it required because every presentation will need at least a presenter.  And there it is.  Now I can go into the settings link and change some of the attributes of this field.  For example, I can make it not required if I want.  I can give it a minimum or a maximum length.  And these attributes depend on the type of field that you're going to be using.  Let's add another field.  Let's say type of presentation.  And this one is going to be a choice.  So it's basically a pick list where now I have to go into the settings because right  now it has no values.  So I'm going to give it some values.  So it could be a keynote or it could be a training or it could be a talk.  And now already you see here the values, the allowed values that I gave it.  So already we can use this, go back to the home page, go to the add new menu and there  is our new type.  And if I create a new one, I see the title and the summary as we've seen.  Those were already there.  And here is the presenter which is required as denoted by the red dot and the type of  presentation.  And because it's required, if I move the mouse out of it, it's telling me, hey, you forgot  to put something in there.  So let's actually, I'm going to put my name in here.  And I'm going to say this is a talk.  Save it.  Oh, of course, I forgot the title.  Save it.  Should always give it a summary for search ability.  It's very important.  But I am cheating right now.  And here it is.  And I can also see it in the contents of my website.  No?  Oh.  There.  There it is.  And it inherits all of the functionality that other content types have.  For example, I can publish it either through this menu, state, or through the state's menu  that's in the toolbar.  I could do that as well.  I'm just going to do it through here.  And there we go.  So I created a content type, and I created my first item of the talk content type.  Before I go, I just want to mention a couple of other things.  So Dexterity allows you to do this through the web, through a browser, but you don't  have to.  You can do something through code in an add-on that you create, that you instantiate with  Mr. Bob, and then you put it in your GitHub repository and all that, all those common development  practices.  But you can also move back and forth between through the web and through code.  So for example, I can, and this, so actually I could, for example, I could write a new  type.  Right now I'm working on my local host on this machine, but I could just now move this  type to a production website by saying I check the box here, and then I say export type profiles.  And this is basically the FTI definition that I mentioned earlier.  It gives me a zip file that I downloaded on my local hard disk.  And now, actually let me do this.  So all right, let's look at it.  So now I've unzipped it.  And actually I'm just going to drag this into my text editor.  I'm not going to do it.  Just, okay, well, let's do it.  All right.  So here at the root of this zip file, there is a, this is a generic setup profile import  step XML file definition.  And in the folder that has the name of the content type, there is the FTI XML definition.  And it also contains the entire XML schema definition that is now encoded, so it looks  really ugly, but it's there.  And if I go back to, let's say now I'm creating a new site.  Now this is a brand new site I just created.  There are no talks, but I can go to the dexterity control panel and click the import type profiles,  browse to the file, where am I?  Browse to the zip file that I just downloaded from the other site.  And there's my talk.  And there it is.  I create, I can't create it.  I think that's all the time I have.  And I did not forget.  So please go to submit your feedback at plonkopf.sixfeedup.com.  And thank you for coming.  And do you have any questions?  What's the difference between those two export options?  Oh, there were two export options.  Okay.  So we exported the type profile.  The schema model, I'll show you what it is by going here.  That's what that is.  That button would give you this XML file.  And this is the schema description.  See it has the presenter, which is a text line.  It has the type of presentation, which is a choice.  And there are the choices.  So that's the entire schema definition of my content type.  The use case for this is that I can actually go in here and change it.  This is an editor.  This is a text editor.  I can make changes to, I can say, required true, for example.  Save it.  And this change is immediately applied to the content type on my website.  I can also download it from the main dexterity control panel here.  I can export it.  And I do it.  And are there like model options that aren't available here?  Yes.  Can you find yourself going to that sometimes?  Because it's the only way to do it.  Yes, I do.  For example, one thing that you can't do, there are many things you can't do through  the browser.  So you will hit a ceiling pretty quickly.  But one example is some fields, you want them to be available only to site administrators  and not to editors.  And so those permissions you cannot do through yet through the browser.  You have to actually, but you can do them just by editing the XML schema.  Yes?  Can you easily add an icon for that new desktop?  That is unfortunately not yet.  So you've noticed, you've noticed, add new.  Everything has an icon.  The talk does not.  Sorry.  Yeah.  Although, maybe, I haven't tried it.  It's possible.  Can you have behavior?  Yes.  Oh, behavior is a whole other topic.  But yes, yes, yes, yes.  That's in fact, that's one of the main use cases.  There is this tab behaviors.  So there we looked at the fields.  We added some fields.  And there's this other tab behaviors that has a lot of behaviors that are really, really  useful and important.  In fact, that's, most of the time, that's what I do.  I don't actually add fields.  I just turn on and off behaviors for content types because it just gives me a whole lot  of things at once that I don't have to, nothing else to do.  Yeah.  If you take an existing content type like events, and if you add something, take an  upload field because I tried this, an upload field, and then you create a new event.  Because I remember that new field doesn't show up.  Am I wrong?  It should show up.  It depends.  It should show up.  It may be that it ended up in a different field set.  So for example, here, these are field sets that we get just from behaviors by default  and we can turn off.  And sometimes people create field sets by mistake instead of fields.  And then they add, so.  Okay.  When you're done, could I come up and try it?  Sure.  Sure.  All right.  Thank you very much.  Thank you.  Thank you.  Thank you.  Thank you.  Thank you.
Day_1__TTW_Content_Types_by_Fulvio_Casali_wcWWzMgbMmg_0_71.png Day_1__TTW_Content_Types_by_Fulvio_Casali_wcWWzMgbMmg_72_1751.png Day_1__TTW_Content_Types_by_Fulvio_Casali_wcWWzMgbMmg_1752_1799.png Day_1__TTW_Content_Types_by_Fulvio_Casali_wcWWzMgbMmg_1800_2531.png Day_1__TTW_Content_Types_by_Fulvio_Casali_wcWWzMgbMmg_2532_3935.png Day_1__TTW_Content_Types_by_Fulvio_Casali_wcWWzMgbMmg_3936_5747.png Day_1__TTW_Content_Types_by_Fulvio_Casali_wcWWzMgbMmg_5748_5879.png Day_1__TTW_Content_Types_by_Fulvio_Casali_wcWWzMgbMmg_5880_8459.png Day_1__TTW_Content_Types_by_Fulvio_Casali_wcWWzMgbMmg_8460_10727.png Day_1__TTW_Content_Types_by_Fulvio_Casali_wcWWzMgbMmg_10728_10775.png Day_1__TTW_Content_Types_by_Fulvio_Casali_wcWWzMgbMmg_10776_12335.png Day_1__TTW_Content_Types_by_Fulvio_Casali_wcWWzMgbMmg_12336_12551.png Day_1__TTW_Content_Types_by_Fulvio_Casali_wcWWzMgbMmg_12552_16019.png Day_1__TTW_Content_Types_by_Fulvio_Casali_wcWWzMgbMmg_16020_16187.png Day_1__TTW_Content_Types_by_Fulvio_Casali_wcWWzMgbMmg_16188_17423.png Day_1__TTW_Content_Types_by_Fulvio_Casali_wcWWzMgbMmg_17424_17471.png Day_1__TTW_Content_Types_by_Fulvio_Casali_wcWWzMgbMmg_17472_17543.png Day_1__TTW_Content_Types_by_Fulvio_Casali_wcWWzMgbMmg_17544_18443.png Day_1__TTW_Content_Types_by_Fulvio_Casali_wcWWzMgbMmg_18444_18923.png Day_1__TTW_Content_Types_by_Fulvio_Casali_wcWWzMgbMmg_18924_19067.png Day_1__TTW_Content_Types_by_Fulvio_Casali_wcWWzMgbMmg_19068_19811.png Day_1__TTW_Content_Types_by_Fulvio_Casali_wcWWzMgbMmg_19812_20423.png Day_1__TTW_Content_Types_by_Fulvio_Casali_wcWWzMgbMmg_20424_20471.png Day_1__TTW_Content_Types_by_Fulvio_Casali_wcWWzMgbMmg_20472_25283.png Day_1__TTW_Content_Types_by_Fulvio_Casali_wcWWzMgbMmg_25284_27167.png Day_1__TTW_Content_Types_by_Fulvio_Casali_wcWWzMgbMmg_27168_27635.png Day_1__TTW_Content_Types_by_Fulvio_Casali_wcWWzMgbMmg_27636_28583.png Day_1__TTW_Content_Types_by_Fulvio_Casali_wcWWzMgbMmg_28584_29135.png Day_1__TTW_Content_Types_by_Fulvio_Casali_wcWWzMgbMmg_29136_29183.png Day_1__TTW_Content_Types_by_Fulvio_Casali_wcWWzMgbMmg_29184_31091.png Day_1__TTW_Content_Types_by_Fulvio_Casali_wcWWzMgbMmg_31092_31475.png Day_1__TTW_Content_Types_by_Fulvio_Casali_wcWWzMgbMmg_31476_35968.png