diff --git a/app/contrib/partners/__init__.py b/app/contrib/partners/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/app/contrib/partners/admin.py b/app/contrib/partners/admin.py new file mode 100644 index 00000000..0962a594 --- /dev/null +++ b/app/contrib/partners/admin.py @@ -0,0 +1,7 @@ +from django.contrib import admin +from .models import Partner + + +@admin.register(Partner) +class PartnerAdmin(admin.ModelAdmin): + list_display = ("name", "link") diff --git a/app/contrib/partners/apps.py b/app/contrib/partners/apps.py new file mode 100644 index 00000000..15856d96 --- /dev/null +++ b/app/contrib/partners/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class PartnersConfig(AppConfig): + default_auto_field = "django.db.models.BigAutoField" + name = "contrib.partners" diff --git a/app/contrib/partners/migrations/0001_initial.py b/app/contrib/partners/migrations/0001_initial.py new file mode 100644 index 00000000..4a52ce20 --- /dev/null +++ b/app/contrib/partners/migrations/0001_initial.py @@ -0,0 +1,29 @@ +# Generated by Django 4.2 on 2024-08-30 23:17 + +from django.db import migrations, models +import django.db.models.deletion +import filer.fields.file + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ('filer', '0017_image__transparent'), + ] + + operations = [ + migrations.CreateModel( + name='Partner', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=100, verbose_name='Nome da Parceria')), + ('link', models.URLField(blank=True, null=True, verbose_name='Link da Parceria')), + ('logo', filer.fields.file.FilerFileField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='filer.file', verbose_name='Imagem')), + ], + options={ + 'verbose_name': 'Parceiro', + }, + ), + ] diff --git a/app/contrib/partners/migrations/__init__.py b/app/contrib/partners/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/app/contrib/partners/models.py b/app/contrib/partners/models.py new file mode 100644 index 00000000..aa757046 --- /dev/null +++ b/app/contrib/partners/models.py @@ -0,0 +1,16 @@ +from django.db import models +from django.utils.translation import gettext_lazy as _ + +from filer.fields.file import FilerFileField + + +class Partner(models.Model): + name = models.CharField(max_length=100, verbose_name="Nome da Parceria") + logo = FilerFileField(verbose_name=_("Imagem"), on_delete=models.SET_NULL, null=True, blank=True) + link = models.URLField(blank=True, null=True, verbose_name="Link da Parceria") + + def __str__(self): + return self.name + + class Meta: + verbose_name = "Parceiro" diff --git a/app/contrib/partners/templates/partners/partners_list.html b/app/contrib/partners/templates/partners/partners_list.html new file mode 100644 index 00000000..a8382d82 --- /dev/null +++ b/app/contrib/partners/templates/partners/partners_list.html @@ -0,0 +1,5 @@ + {% for partner in partners %} + + {{ partner.name }} + + {% endfor %} diff --git a/app/contrib/partners/templatetags/partners_tags.py b/app/contrib/partners/templatetags/partners_tags.py new file mode 100644 index 00000000..b87d7dc9 --- /dev/null +++ b/app/contrib/partners/templatetags/partners_tags.py @@ -0,0 +1,9 @@ +from django import template +from ..models import Partner + +register = template.Library() + +@register.inclusion_tag("partners/partners_list.html") +def show_partners(): + partners = Partner.objects.all() + return {'partners': partners} diff --git a/app/org_eleicoes/votepeloclima/settings/base.py b/app/org_eleicoes/votepeloclima/settings/base.py index 44ae6dc0..670e89f8 100644 --- a/app/org_eleicoes/votepeloclima/settings/base.py +++ b/app/org_eleicoes/votepeloclima/settings/base.py @@ -74,6 +74,7 @@ "contrib.ds.picture", "contrib.ds.tooltip", # Project Apps + "contrib.partners", "contrib.oauth", "org_eleicoes.votepeloclima", "org_eleicoes.votepeloclima.candidature", diff --git a/app/org_eleicoes/votepeloclima/static/scss/custom.scss b/app/org_eleicoes/votepeloclima/static/scss/custom.scss index 1c6ddcca..c41a009d 100644 --- a/app/org_eleicoes/votepeloclima/static/scss/custom.scss +++ b/app/org_eleicoes/votepeloclima/static/scss/custom.scss @@ -195,3 +195,19 @@ legend.form-label { min-height: 230px; } } + +// Partner Tag +.partners-list { + a { + display: flex; + justify-content: center; + align-items: center; + } + + img { + width: 125px; + height: 70px; + object-fit: contain; + object-position: center; + } +} \ No newline at end of file diff --git a/app/org_eleicoes/votepeloclima/templates/votepeloclima/base.html b/app/org_eleicoes/votepeloclima/templates/votepeloclima/base.html index 984a4f39..cf098ed4 100644 --- a/app/org_eleicoes/votepeloclima/templates/votepeloclima/base.html +++ b/app/org_eleicoes/votepeloclima/templates/votepeloclima/base.html @@ -1,5 +1,5 @@ {% extends "ds/base.html" %} -{% load static cms_tags menu_tags compress %} +{% load static cms_tags menu_tags compress partners_tags %} {% block head_css %} {{block.super}} @@ -83,6 +83,13 @@
Realização

© 2024. Nossas e Clima de Eleição. Direitos reservados.

+
+
+
Quem assina
+
+ {% show_partners %} +
+
diff --git a/app/project/settings/django_settings.py b/app/project/settings/django_settings.py index 8aeb74a4..ea4b77f3 100644 --- a/app/project/settings/django_settings.py +++ b/app/project/settings/django_settings.py @@ -91,6 +91,7 @@ "contrib.frontend.grid", "contrib.frontend.maps", "contrib.ga", + "contrib.partners", # # "contrib.domains.route53", # "contrib.domains.traefik",