title: Content part editing view not displayed when creating a content item in Orchard
body: <p>I created a content part and then added it to a content type in Orchard. But when I try to create a content item of that type, the fields for the part's properties are not displayed. I'm looking for suggestions of where the problem might be.</p>
  
  <p>UPD: the relevant code:</p>
  
  <pre><code>using JetBrains.Annotations;
  using ArealAds.Models;
  using Orchard.ContentManagement;
  using Orchard.ContentManagement.Drivers;
  using ArealAds.Models;
  using ArealAds.Services;
  using ArealAds.ViewModels;
  
  namespace ArealAds.Drivers {
      [UsedImplicitly]
      public class AdDriver : ContentPartDriver&lt;AdPart&gt; {
          private readonly IAdService _adService;
  
          public AdDriver (IAdService adService)
          {
              _adService = adService;
          }
  
          protected override string Prefix {
              get { return "AdPart"; }
          }
  
          protected override DriverResult Display(
              AdPart part, string displayType, dynamic shapeHelper) {
  
              return ContentShape("Parts_Ad", () =&gt; shapeHelper.Parts_Ad(
                  Title: part.Title,
                  Url: part.Url,
                  Email: part.Email,
                  Phone1: part.Phone1,
                  Phone2: part.Phone2,
                  AreaName: part.AreaRecord.Name,
                  AreaId: part.AreaRecord.Id,
                  DistrictName: part.DistrictRecord.Name,
                  DistrictId: part.DistrictRecord.Id,
                  AllDistricts: part.AllDistricts));
          }
  
          //GET
          protected override DriverResult Editor(
              AdPart part, dynamic shapeHelper) {
  
              return ContentShape("Parts_Ad_Edit",
                  () =&gt; shapeHelper.EditorTemplate(
                      TemplateName: "Parts/Ad",
                      Model: BuildEditorViewModel(part),
                      Prefix: Prefix));
          }
          //POST
          protected override DriverResult Editor(
              AdPart part,
              IUpdateModel updater,
              dynamic shapeHelper) {
  
              var model = new EditAdViewModel();
              updater.TryUpdateModel(model, Prefix, null, null);
  
              if (part.ContentItem.Id != 0) {
                  _adService.Update(
                      part.ContentItem, model);
              }
  
              return Editor(part, shapeHelper);
          }
  
          private EditAdViewModel BuildEditorViewModel(AdPart part) {
              var avm = new EditAdViewModel {
                  Title = part.Title,
                  Url = part.Url,
                  Email = part.Email,
                  Phone1 = part.Phone1,
                  Phone2 = part.Phone2,
                  AllDistricts = part.AllDistricts,
                  Areas = _adService.GetAreas(),
                  Districts = _adService.GetDistricts()
              };
              if (part.AreaRecord != null) {
                  avm.AreaName = part.AreaRecord.Name;
                  avm.AreaId = part.AreaRecord.Id;
              }
              if (part.DistrictRecord != null) {
                  avm.DistrictName = part.DistrictRecord.Name;
                  avm.DistrictId = part.DistrictRecord.Id;
              }
              return avm;
          }
      }
  }
  
  using System.ComponentModel.DataAnnotations;
  using Orchard.ContentManagement;
  using Orchard.ContentManagement.Records;
  
  namespace ArealAds.Models {
      public class AdRecord : ContentPartRecord {
          public virtual string Title { get; set; }
          public virtual string Url { get; set; }
          public virtual string Email { get; set; }
          public virtual string Phone1 { get; set; }
          public virtual string Phone2 { get; set; }
          public virtual AreaRecord AreaRecord { get; set; }
          public virtual DistrictRecord DistrictRecord { get; set; }
          public virtual bool AllDistricts { get; set; }
      }
  
      public class AdPart : ContentPart&lt;AdRecord&gt; {
          [Required]
          public string Title {
              get { return Record.Title; }
              set { Record.Title = value; }
          }
  
          public string Url {
              get { return Record.Url; }
              set { Record.Url = value; }
          }
  
          public string Email {
              get { return Record.Email; }
              set { Record.Email = value; }
          }
  
          public string Phone1 {
              get { return Record.Phone1; }
              set { Record.Phone1 = value; }
          }
  
          public string Phone2 {
              get { return Record.Phone2; }
              set { Record.Phone2 = value; }
          }
  
          public AreaRecord AreaRecord {
              get { return Record.AreaRecord; }
              set { Record.AreaRecord = value; }
          }
  
          public DistrictRecord DistrictRecord {
              get { return Record.DistrictRecord; }
              set { Record.DistrictRecord = value; }
          }
  
          [Required]
          public bool AllDistricts {
              get { return Record.AllDistricts; }
              set { Record.AllDistricts = value; }
          }
      }
  }
  
  
  @model ArealAds.ViewModels.EditAdViewModel
  
  &lt;fieldset&gt;
    &lt;legend&gt;Area Fields&lt;/legend&gt;
  
    &lt;div class="editor-label"&gt;
      @Html.LabelFor(model =&gt; model.Title)
    &lt;/div&gt;
    &lt;div class="editor-field"&gt;
      @Html.TextBoxFor(model =&gt; model.Title)
      @Html.ValidationMessageFor(model =&gt; model.Title)
    &lt;/div&gt;
  
    &lt;div class="editor-label"&gt;
      @Html.LabelFor(model =&gt; model.Url)
    &lt;/div&gt;
    &lt;div class="editor-field"&gt;
      @Html.TextBoxFor(model =&gt; model.Url)
      @Html.ValidationMessageFor(model =&gt; model.Url)
    &lt;/div&gt;
  
    &lt;div class="editor-label"&gt;
      @Html.LabelFor(model =&gt; model.Email)
    &lt;/div&gt;
    &lt;div class="editor-field"&gt;
      @Html.TextBoxFor(model =&gt; model.Email)
      @Html.ValidationMessageFor(model =&gt; model.Email)
    &lt;/div&gt;
  
    &lt;div class="editor-label"&gt;
      @Html.LabelFor(model =&gt; model.Phone1)
    &lt;/div&gt;
    &lt;div class="editor-field"&gt;
      @Html.TextBoxFor(model =&gt; model.Phone1)
      @Html.ValidationMessageFor(model =&gt; model.Phone1)
    &lt;/div&gt;
  
    &lt;div class="editor-label"&gt;
      @Html.LabelFor(model =&gt; model.Phone2)
    &lt;/div&gt;
    &lt;div class="editor-field"&gt;
      @Html.TextBoxFor(model =&gt; model.Phone2)
      @Html.ValidationMessageFor(model =&gt; model.Phone2)
    &lt;/div&gt;
  
    &lt;div class="editor-label"&gt;
      @Html.LabelFor(model =&gt; model.AllDistricts)
    &lt;/div&gt;
    &lt;div class="editor-field"&gt;
      @Html.CheckBoxFor(model =&gt; model.AllDistricts)
      @Html.ValidationMessageFor(model =&gt; model.AllDistricts)
    &lt;/div&gt;
  
    &lt;table&gt;
    &lt;tr&gt;
    &lt;td&gt;
    &lt;div class="editor-label"&gt;
      @Html.LabelFor(model =&gt; model.AreaId)
    &lt;/div&gt;
    &lt;div class="editor-field"&gt;
      @Html.DropDownListFor(model =&gt; model.AreaId,
                            Model.Areas.Select(s =&gt; new SelectListItem {
                                Selected = s.Id == Model.AreaId,
                                Text = s.Name,
                                Value = s.Id.ToString()
                            }),
                        "Выберите район...")
      @Html.ValidationMessageFor(model =&gt; model.AreaId)
    &lt;/div&gt;
    &lt;/td&gt;
    &lt;td&gt;или&lt;/td&gt;
    &lt;td&gt;
    &lt;div class="editor-label"&gt;
      @Html.LabelFor(model =&gt; model.DistrictId)
    &lt;/div&gt;
    &lt;div class="editor-field"&gt;
      @Html.DropDownListFor(model =&gt; model.DistrictId,
                            Model.Districts.Select(s =&gt; new SelectListItem {
                                Selected = s.Id == Model.DistrictId,
                                Text = s.Name,
                                Value = s.Id.ToString()
                            }),
                        "Выберите округ...")
      @Html.ValidationMessageFor(model =&gt; model.DistrictId)
    &lt;/div&gt;
    &lt;/td&gt;
    &lt;/tr&gt;
    &lt;/table&gt;
  
  &lt;/fieldset&gt;
  
  
              SchemaBuilder.CreateTable("AdRecord", table =&gt; table
                  .ContentPartRecord()
                  .Column&lt;string&gt;("Title")
                  .Column&lt;string&gt;("Url")
                  .Column&lt;string&gt;("Email")
                  .Column&lt;string&gt;("Phone1")
                  .Column&lt;string&gt;("Phone2")
                  .Column&lt;int&gt;("AreaRecord_Id")
                  .Column&lt;int&gt;("DistrictRecord_Id")
                  .Column&lt;bool&gt;("AllDistricts")
              );
  
              ContentDefinitionManager.AlterPartDefinition(
                  typeof(AdPart).Name, cfg =&gt; cfg.Attachable());
  
              ContentDefinitionManager.AlterTypeDefinition(
                  "ArealAds_Ad", cfg =&gt; cfg
                  .WithPart("CommonPart")
                  .WithPart("AdPart")
                  .Creatable()
              );
  </code></pre>