Skip to content
This repository was archived by the owner on Jun 18, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2017-06-22 13:07
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('rca', '0086_schoolpageresearchlinks_allow_to_add_external_links'),
]

operations = [
migrations.AddField(
model_name='innovationrcaproject',
name='featured',
field=models.BooleanField(default=False, help_text=b''),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.9 on 2017-06-22 13:13
from __future__ import unicode_literals

from django.db import migrations


def populate_innovationrcaproject_featured(apps, schema_editor):
InnovationRCAProject = apps.get_model('rca.InnovationRCAProject')
InnovationRCAProject.objects.all().update(featured=True)


class Migration(migrations.Migration):

dependencies = [
('rca', '0087_innovationrcaproject_featured'),
]

operations = [
migrations.RunPython(populate_innovationrcaproject_featured),
]
8 changes: 5 additions & 3 deletions django-verdant/rca/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -832,12 +832,12 @@ class ProgrammePage(Page, SocialFields, SidebarBehaviourFields):
programme_specification_document = models.ForeignKey('wagtaildocs.Document', null=True, blank=True, related_name='+', on_delete=models.SET_NULL, help_text=help_text('rca.ProgrammePage', 'programme_specification', default="Download the programme specification"))
ma_programme_description_link = models.ForeignKey(Page, null=True, blank=True, on_delete=models.SET_NULL, related_name='+', help_text=help_text('rca.ProgrammePage', 'ma_programme_description_link'))
ma_programme_description_link_text = models.CharField(max_length=255, blank=True, help_text=help_text('rca.ProgrammePage', 'ma_programme_description_link_text'))

ma_programme_staff_link = models.URLField("Programme staff link", blank=True, help_text=help_text('rca.ProgrammePage', 'ma_programme_staff_link'))
ma_programme_staff_link_text = models.CharField(max_length=255, blank=True, help_text=help_text('rca.ProgrammePage', 'ma_programme_staff_link_text'))
ma_programme_overview_link = models.ForeignKey(Page, null=True, blank=True, on_delete=models.SET_NULL, related_name='+', help_text=help_text('rca.ProgrammePage', 'ma_programme_overview_link'))
ma_programme_overview_link_text = models.CharField(max_length=255, blank=True, help_text=help_text('rca.ProgrammePage', 'ma_entry_requirements_link_text'))

ma_entry_requirements_link = models.ForeignKey(Page, null=True, blank=True, on_delete=models.SET_NULL, related_name='+', help_text=help_text('rca.ProgrammePage', 'ma_entry_requirements_link'))
ma_entry_requirements_link_text = models.CharField(max_length=255, blank=True, help_text=help_text('rca.ProgrammePage', 'ma_programme_overview_link_text'))
facilities_link = models.ForeignKey(Page, null=True, blank=True, on_delete=models.SET_NULL, related_name='+', help_text=help_text('rca.ProgrammePage', 'facilities_link'))
Expand Down Expand Up @@ -5612,6 +5612,7 @@ class InnovationRCAProject(Page, SocialFields):
project_ended = models.BooleanField(default=False, help_text=help_text('rca.InnovationRCAProject', 'project_ended'))
random_order = models.IntegerField(null=True, blank=True, editable=False)
feed_image = models.ForeignKey('rca.RcaImage', null=True, blank=True, on_delete=models.SET_NULL, related_name='+', help_text=help_text('rca.InnovationRCAProject', 'feed_image', default="The image displayed in content feeds, such as the news carousel. Should be 16:9 ratio."))
featured = models.BooleanField(default=False, help_text=help_text('rca.InnovationRCAProject', 'featured'))

search_fields = Page.search_fields + [
index.SearchField('subtitle'),
Expand Down Expand Up @@ -5684,6 +5685,7 @@ class Meta:
MultiFieldPanel([
FieldPanel('show_in_menus'),
FieldPanel('show_on_homepage'),
FieldPanel('featured'),
ImageChooserPanel('feed_image'),
FieldPanel('search_description'),
], 'Cross-page behaviour'),
Expand Down Expand Up @@ -5715,7 +5717,7 @@ class InnovationRCAIndex(Page, SocialFields):
@vary_on_headers('X-Requested-With')
def serve(self, request):
# Get list of live projects
projects = InnovationRCAProject.objects.filter(live=True, path__startswith=self.path)
projects = InnovationRCAProject.objects.live().child_of(self).filter(featured=True)

# Apply filters
project_type = request.GET.get('project_type')
Expand Down