|
| 1 | +from django.db import models |
| 2 | + |
| 3 | +from wagtail.admin.panels import FieldPanel, MultiFieldPanel |
| 4 | +from wagtail.fields import RichTextField, StreamField |
| 5 | +from wagtail.blocks import CharBlock, StreamBlock, StructBlock, URLBlock, RichTextBlock, PageChooserBlock |
| 6 | +from wagtail.models import Page |
| 7 | + |
| 8 | + |
| 9 | +class RequestForProposalOwnerPage(Page): |
| 10 | + subpage_types = [ |
| 11 | + 'rfp.IndividualRequestForProposalPage' |
| 12 | + ] |
| 13 | + |
| 14 | + max_count = 1 |
| 15 | + |
| 16 | + posted_by_prefix_text = models.CharField(default="Posted by") |
| 17 | + |
| 18 | + terms_of_reference_title = models.CharField(default="Terms of Reference") |
| 19 | + role_title = models.CharField(default="Role:") |
| 20 | + application_close_title = models.CharField(default="Application Close Date:") |
| 21 | + project_duration_title = models.CharField(default="Duration of Project:") |
| 22 | + work_location_title = models.CharField(default="Work Location:") |
| 23 | + contract_type_title = models.CharField(default="Type of Contract:") |
| 24 | + direct_contact_title = models.CharField(default="Direct Contact:") |
| 25 | + cta_title = models.CharField(blank=True) |
| 26 | + submission_email_button = models.CharField(default="Submission Email") |
| 27 | + |
| 28 | + go_back_text = models.CharField(default="Go Back to Request for Proposals") |
| 29 | + |
| 30 | + content_panels = Page.content_panels + [ |
| 31 | + FieldPanel('posted_by_prefix_text'), |
| 32 | + MultiFieldPanel([ |
| 33 | + FieldPanel('terms_of_reference_title'), |
| 34 | + FieldPanel('role_title'), |
| 35 | + FieldPanel('application_close_title'), |
| 36 | + FieldPanel('project_duration_title'), |
| 37 | + FieldPanel('work_location_title'), |
| 38 | + FieldPanel('contract_type_title'), |
| 39 | + FieldPanel('direct_contact_title'), |
| 40 | + FieldPanel('cta_title'), |
| 41 | + FieldPanel('submission_email_button'), |
| 42 | + ], heading="Sidebar"), |
| 43 | + FieldPanel('go_back_text'), |
| 44 | + ] |
| 45 | + |
| 46 | + |
| 47 | +class IndividualRequestForProposalPage(Page): |
| 48 | + parent_page_type = [ |
| 49 | + 'rfp.RequestForProposalOwnerPage' |
| 50 | + ] |
| 51 | + |
| 52 | + posters = StreamField([('poster', PageChooserBlock(page_type="members.IndividualMemberPage"))], use_json_field=True, null=True, blank=True) |
| 53 | + post_date = models.DateField(blank=True, null=True) |
| 54 | + |
| 55 | + intro = RichTextField(blank=True) |
| 56 | + article_body = StreamField([ |
| 57 | + ('text_block', RichTextBlock(features=[ |
| 58 | + 'h1', 'h2', 'h3', 'h4', 'bold', 'italic', 'link', 'ol', 'ul', 'hr', 'document-link', 'image', 'embed', 'code', 'blockquote' |
| 59 | + ])) |
| 60 | + ], use_json_field=True, null=True, blank=True) |
| 61 | + |
| 62 | + role = models.CharField(blank=True) |
| 63 | + application_close_date = models.DateField(blank=True, null=True) |
| 64 | + project_duration = models.CharField(blank=True) |
| 65 | + work_location = models.CharField(blank=True) |
| 66 | + contract_type = models.CharField(blank=True) |
| 67 | + direct_contact = models.CharField(blank=True) |
| 68 | + submission_email = models.EmailField(blank=True) |
| 69 | + |
| 70 | + content_panels = Page.content_panels + [ |
| 71 | + FieldPanel('posters'), |
| 72 | + FieldPanel('post_date'), |
| 73 | + FieldPanel('intro'), |
| 74 | + FieldPanel('article_body'), |
| 75 | + MultiFieldPanel([ |
| 76 | + FieldPanel('role'), |
| 77 | + FieldPanel('application_close_date'), |
| 78 | + FieldPanel('project_duration'), |
| 79 | + FieldPanel('work_location'), |
| 80 | + FieldPanel('contract_type'), |
| 81 | + FieldPanel('direct_contact'), |
| 82 | + FieldPanel('submission_email'), |
| 83 | + ], heading="Sidebar"), |
| 84 | + ] |
0 commit comments