Skip to content

Commit

Permalink
Merge pull request #23 from hotosm/feat/ind-program-page
Browse files Browse the repository at this point in the history
Feat/ind program page
  • Loading branch information
luminaryFlowers authored May 21, 2024
2 parents beab81f + e46c57d commit 3ef9637
Show file tree
Hide file tree
Showing 37 changed files with 650 additions and 11 deletions.
Empty file added app/core/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions app/core/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
6 changes: 6 additions & 0 deletions app/core/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class CoreConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'app.core'
28 changes: 28 additions & 0 deletions app/core/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated by Django 4.2.7 on 2024-05-15 21:39

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

initial = True

dependencies = [
('wagtailimages', '0025_alter_image_file_alter_rendition_file'),
]

operations = [
migrations.CreateModel(
name='Partner',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('partner_name', models.CharField()),
('partner_url', models.URLField()),
('partner_logo', models.ForeignKey(blank=True, help_text='Partner logo', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image')),
],
options={
'verbose_name_plural': 'Partners',
},
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Generated by Django 4.2.7 on 2024-05-15 21:50

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('wagtailimages', '0025_alter_image_file_alter_rendition_file'),
('core', '0001_initial'),
]

operations = [
migrations.AlterField(
model_name='partner',
name='partner_logo',
field=models.ForeignKey(help_text='Partner logo', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image'),
),
migrations.AlterField(
model_name='partner',
name='partner_url',
field=models.URLField(blank=True),
),
]
Empty file added app/core/migrations/__init__.py
Empty file.
29 changes: 29 additions & 0 deletions app/core/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from django.db import models

from wagtail.snippets.models import register_snippet
from wagtail.admin.panels import FieldPanel, MultiFieldPanel, InlinePanel


@register_snippet
class Partner(models.Model):
partner_name = models.CharField()
partner_logo = models.ForeignKey(
"wagtailimages.Image",
null=True,
on_delete=models.SET_NULL,
related_name="+",
help_text="Partner logo"
)
partner_url = models.URLField(blank=True)

panels = [
FieldPanel("partner_name"),
FieldPanel("partner_logo"),
FieldPanel("partner_url"),
]

def __str__(self):
return self.partner_name

class Meta:
verbose_name_plural = "Partners"
3 changes: 3 additions & 0 deletions app/core/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.test import TestCase

# Create your tests here.
3 changes: 3 additions & 0 deletions app/core/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.shortcuts import render

# Create your views here.
4 changes: 2 additions & 2 deletions app/news/templates/news/individual_news_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ <h1>{{ page.title }}</h1>
<h1 class="text-h2 font-bold mb-4">
{{ page.related_projects_title }}
</h1>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-1">
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-1 gap-x-4">
{% with projects=page.related_projects %}
{% for project in projects %}
{% include "ui/components/projects/ProjectPreviewBlockNews.html" with project=project.value %}
Expand All @@ -54,7 +54,7 @@ <h1 class="text-h2 font-bold mb-4">
{{ page.related_news_title }}
</h1>
{% include "ui/components/BaseLink.html" with linkurl="#" linktext=page.view_all_news_text %}
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-1">
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-1 gap-x-4">
{% with allnews=page.related_news %}
{% for news in allnews %}
{% include "ui/components/news/NewsPreviewBlockNews.html" with news=news.value %}
Expand Down
Empty file added app/programs/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions app/programs/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django.contrib import admin

# Register your models here.
6 changes: 6 additions & 0 deletions app/programs/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from django.apps import AppConfig


class ProgramsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'app.programs'
42 changes: 42 additions & 0 deletions app/programs/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Generated by Django 4.2.7 on 2024-05-15 16:06

from django.db import migrations, models
import django.db.models.deletion
import wagtail.blocks
import wagtail.fields
import wagtail.images.blocks


class Migration(migrations.Migration):

initial = True

dependencies = [
('wagtailimages', '0025_alter_image_file_alter_rendition_file'),
('wagtailcore', '0089_log_entry_data_json_null_to_object'),
]

operations = [
migrations.CreateModel(
name='IndividualProgramPage',
fields=[
('page_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='wagtailcore.page')),
('subtitle', wagtail.fields.RichTextField(blank=True)),
('intro', wagtail.fields.RichTextField(blank=True)),
('description', wagtail.fields.RichTextField(blank=True)),
('stats_title', models.CharField(default='Stats')),
('stats', wagtail.fields.StreamField([('stat_block', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock()), ('description', wagtail.blocks.RichTextBlock())]))], blank=True, null=True, use_json_field=True)),
('goals_title', models.CharField(default='Goals')),
('goals', wagtail.fields.StreamField([('goal_block', wagtail.blocks.StructBlock([('title', wagtail.blocks.CharBlock()), ('description', wagtail.blocks.RichTextBlock()), ('icon', wagtail.images.blocks.ImageChooserBlock())]))], blank=True, null=True, use_json_field=True)),
('projects_title', models.CharField(default='Projects')),
('partners_title', models.CharField(default='Meet Our Partners')),
('more_programs_title', models.CharField(default='More Programs')),
('header_image', models.ForeignKey(blank=True, help_text='Header image', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image')),
('intro_image', models.ForeignKey(blank=True, help_text='Intro image', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailimages.image')),
],
options={
'abstract': False,
},
bases=('wagtailcore.page',),
),
]
20 changes: 20 additions & 0 deletions app/programs/migrations/0002_individualprogrampage_partners.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 4.2.7 on 2024-05-15 21:46

from django.db import migrations
import modelcluster.fields


class Migration(migrations.Migration):

dependencies = [
('core', '0001_initial'),
('programs', '0001_initial'),
]

operations = [
migrations.AddField(
model_name='individualprogrampage',
name='partners',
field=modelcluster.fields.ParentalManyToManyField(blank=True, to='core.partner'),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 4.2.7 on 2024-05-15 23:29

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('programs', '0002_individualprogrampage_partners'),
]

operations = [
migrations.AddField(
model_name='individualprogrampage',
name='view_all_partners_title',
field=models.CharField(default='View All Partners'),
),
migrations.AddField(
model_name='individualprogrampage',
name='view_all_programs_title',
field=models.CharField(default='View All Programs'),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Generated by Django 4.2.7 on 2024-05-15 23:33

from django.db import migrations, models
import wagtail.blocks
import wagtail.fields


class Migration(migrations.Migration):

dependencies = [
('programs', '0003_individualprogrampage_view_all_partners_title_and_more'),
]

operations = [
migrations.AddField(
model_name='individualprogrampage',
name='more_programs',
field=wagtail.fields.StreamField([('program_page', wagtail.blocks.PageChooserBlock(page_type=['programs.IndividualProgramPage']))], blank=True, null=True, use_json_field=True),
),
migrations.AddField(
model_name='individualprogrampage',
name='view_all_partners_link',
field=models.CharField(blank=True),
),
migrations.AddField(
model_name='individualprogrampage',
name='view_all_programs_link',
field=models.URLField(blank=True),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated by Django 4.2.7 on 2024-05-21 16:33

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('programs', '0004_individualprogrampage_more_programs_and_more'),
]

operations = [
migrations.AddField(
model_name='individualprogrampage',
name='bottom_banner_text',
field=models.CharField(default='Check out the many opportunities to get involved with HOT!'),
),
migrations.AddField(
model_name='individualprogrampage',
name='bottom_banner_url',
field=models.URLField(blank=True),
),
migrations.AddField(
model_name='individualprogrampage',
name='bottom_banner_url_text',
field=models.CharField(default='Get Involved with HOT'),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.7 on 2024-05-21 16:47

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('programs', '0005_individualprogrampage_bottom_banner_text_and_more'),
]

operations = [
migrations.AlterField(
model_name='individualprogrampage',
name='bottom_banner_text',
field=models.CharField(default='Check out many opportunities to get involved with HOT!'),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.7 on 2024-05-21 17:04

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('programs', '0006_alter_individualprogrampage_bottom_banner_text'),
]

operations = [
migrations.AlterField(
model_name='individualprogrampage',
name='bottom_banner_text',
field=models.CharField(default='Check out the many opportunities to get involved with HOT!'),
),
]
Empty file.
Loading

0 comments on commit 3ef9637

Please sign in to comment.