Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Deploy to PRD] New Card Person Plugin + Requirements Update #1016

Merged
merged 14 commits into from
Nov 30, 2023
Merged
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
Empty file.
12 changes: 12 additions & 0 deletions foundation/okfplugins/card_person/admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from django.contrib import admin

import reversion

from .models import CardPerson


class CardPersonAdmin(reversion.admin.VersionAdmin):
list_display = ("name", "role", "email")


admin.site.register(CardPerson, CardPersonAdmin)
14 changes: 14 additions & 0 deletions foundation/okfplugins/card_person/cms_plugins.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from django.utils.translation import gettext_lazy as _

from .models import CardPerson


@plugin_pool.register_plugin
class CardPersonPlugin(CMSPluginBase):
model = CardPerson
module = "OKF v2"
name = _("Card Person Plugin")
render_template = "card_person.html"
cache = False
32 changes: 32 additions & 0 deletions foundation/okfplugins/card_person/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Generated by Django 4.2.3 on 2023-11-29 10:49

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


class Migration(migrations.Migration):

initial = True

dependencies = [
('cms', '0022_auto_20180620_1551'),
]

operations = [
migrations.CreateModel(
name='CardPerson',
fields=[
('cmsplugin_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, related_name='%(app_label)s_%(class)s', serialize=False, to='cms.cmsplugin')),
('name', models.CharField(max_length=100)),
('description', models.TextField(blank=True, null=True)),
('photo', models.ImageField(blank=True, upload_to='card_person/photos')),
('email', models.EmailField(blank=True, max_length=254)),
('url', models.URLField(blank=True)),
('x_account', models.CharField(blank=True, max_length=18)),
],
options={
'abstract': False,
},
bases=('cms.cmsplugin',),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.2.3 on 2023-11-29 10:59

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('card_person', '0001_initial'),
]

operations = [
migrations.AddField(
model_name='cardperson',
name='role',
field=models.CharField(blank=True, max_length=100, null=True),
),
]
Empty file.
13 changes: 13 additions & 0 deletions foundation/okfplugins/card_person/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from cms.models.pluginmodel import CMSPlugin

from django.db import models


class CardPerson(CMSPlugin):
name = models.CharField(max_length=100)
role = models.CharField(max_length=100, null=True, blank=True)
description = models.TextField(blank=True, null=True)
photo = models.ImageField(upload_to="card_person/photos", blank=True)
email = models.EmailField(blank=True)
url = models.URLField(blank=True)
x_account = models.CharField(max_length=18, blank=True)
39 changes: 39 additions & 0 deletions foundation/okfplugins/card_person/templates/card_person.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{% load markdown_deux_tags %}
{% load static %}

<div class="card-person mb-20 {{ className }}" id="{{ instance.name|slugify }}">
<div class="card-person__content">
<div class="intro">
<div class="image flex-shrink-0">
<img src="{% if instance.photo %}{{ instance.photo.url }}{% else %}{{ instance.gravatar_url }}{% endif %}" alt="{{ instance.name }}">
</div>
<div class="content">
<h2 class="name">{{ instance.name }}</h2>
<div class="font-mono block-txt">
<span class="position">{% if instance.role %}{{ instance.role }}{% endif %}</span>
{% if instance.url %}
<a href="{{ instance.url }}" class="flex items-center gap-2 mb-3">
<img src="{% static '/images/icons/link.svg' %}">
{{ instance.url }}
</a>
{% endif %}
{% if instance.email %}
<a href="mailto:{{ instance.email }}" class="flex items-center gap-2 mb-3">
<img src="{% static '/images/icons/envelope.svg' %}">
{{ instance.email }}
</a>
{% endif %}
{% if instance.x_account %}
<a href="https://twitter.com/{{ instance.x_account }}" class="flex items-center gap-2">
<img src="{% static '/images/icons/twitter.svg' %}">
@{{ instance.x_account }}
</a>
{% endif %}
</div>
</div>
</div>
<div class="block-txt">
{{ instance.description|markdown }}
</div>
</div>
</div>
1 change: 1 addition & 0 deletions foundation/organisation/templates/organisation/member.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- This template is deprecated. Please use card_person plugin. -->
{% load markdown_deux_tags %}
{% load static %}

Expand Down
5 changes: 3 additions & 2 deletions foundation/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ def _parse_email_list(varname):
'foundation.okfplugins.list',
'foundation.okfplugins.content_list',
'foundation.okfplugins.number_stat',
'foundation.okfplugins.background'
'foundation.okfplugins.background',
'foundation.okfplugins.card_person',
)

MIDDLEWARE = [
Expand Down Expand Up @@ -296,7 +297,7 @@ def _parse_email_list(varname):
LANGUAGES = [
('en', 'English'),
('es', 'Spanish'),
('pt', 'Portuguese'),
('fr', 'French'),
]

TIME_ZONE = 'UTC'
Expand Down
6 changes: 3 additions & 3 deletions requirements.dev.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

-c requirements.txt

pip-tools==7.1.0
pip-tools==7.3.0
flake8==6.1.0
django-webtest==1.9.10
coverage==7.2.7
django-webtest==1.9.11
coverage==7.3.2
6 changes: 3 additions & 3 deletions requirements.dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ build==0.10.0
# via pip-tools
click==8.1.4
# via pip-tools
coverage==7.2.7
coverage==7.3.2
# via -r requirements.dev.in
django-webtest==1.9.10
django-webtest==1.9.11
# via -r requirements.dev.in
flake8==6.1.0
# via -r requirements.dev.in
Expand All @@ -24,7 +24,7 @@ packaging==21.3
# via
# -c requirements.txt
# build
pip-tools==7.1.0
pip-tools==7.3.0
# via -r requirements.dev.in
pycodestyle==2.11.0
# via flake8
Expand Down
12 changes: 6 additions & 6 deletions requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ beautifulsoup4==4.12.2
cssmin==0.2.0

Django==4.2.3
django-cms==3.11.3
django-cms==3.11.4
django-compressor==4.4
django-countries==7.5.1
django-csp==3.7
Expand All @@ -22,12 +22,12 @@ django-reversion==5.0.4
django-sekizai==4.1.0
django-storages==1.13.2
django-treebeard==4.7
django-simple-captcha==0.5.18
djangocms-admin-style==3.2.4
django-simple-captcha==0.5.20
djangocms-admin-style==3.2.6
# djangocms-attributes-field could be removed when other deps updates to 3.0.0
djangocms-attributes-field==3.0.0
djangocms-picture==4.0.0
djangocms-text-ckeditor==5.1.3
djangocms-text-ckeditor==5.1.4

easy-thumbnails==2.8.5
feedparser==6.0.10
Expand All @@ -40,7 +40,7 @@ libsass==0.22.0
micawber==0.5.5
# django-pagedown, djangocms-text-ckeditor and easy-thumbnails use it but don't specify the version
# this is a secure version
pillow==10.0.0
psycopg2-binary==2.9.6
pillow==10.1.0
psycopg2-binary==2.9.9
requests==2.31.0
whoosh==2.7.4
15 changes: 8 additions & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile
# pip-compile requirements.in
#
asgiref==3.7.2
# via
Expand Down Expand Up @@ -41,6 +41,7 @@ django==4.2.3
# django-simple-captcha
# django-storages
# django-treebeard
# djangocms-admin-style
# easy-thumbnails
# jsonfield
django-appconf==1.0.4
Expand All @@ -49,7 +50,7 @@ django-classy-tags==3.0.1
# via
# django-cms
# django-sekizai
django-cms==3.11.3
django-cms==3.11.4
# via
# -r requirements.in
# djangocms-attributes-field
Expand Down Expand Up @@ -93,15 +94,15 @@ django-sekizai==4.1.0
# via
# -r requirements.in
# django-cms
django-simple-captcha==0.5.18
django-simple-captcha==0.5.20
# via -r requirements.in
django-storages==1.13.2
# via -r requirements.in
django-treebeard==4.7
# via
# -r requirements.in
# django-cms
djangocms-admin-style==3.2.4
djangocms-admin-style==3.2.6
# via
# -r requirements.in
# django-cms
Expand All @@ -111,7 +112,7 @@ djangocms-attributes-field==3.0.0
# djangocms-picture
djangocms-picture==4.0.0
# via -r requirements.in
djangocms-text-ckeditor==5.1.3
djangocms-text-ckeditor==5.1.4
# via -r requirements.in
easy-thumbnails[svg]==2.8.5
# via
Expand Down Expand Up @@ -163,7 +164,7 @@ packaging==21.3
# django-cms
# djangocms-text-ckeditor
# gunicorn
pillow==10.0.0
pillow==10.1.0
# via
# -r requirements.in
# django-pagedown
Expand All @@ -175,7 +176,7 @@ protobuf==3.19.1
# via
# google-api-core
# googleapis-common-protos
psycopg2-binary==2.9.6
psycopg2-binary==2.9.9
# via -r requirements.in
pyasn1==0.4.8
# via
Expand Down
Loading