From d1e73cdf0899143674fed10ca95e81b4f825b119 Mon Sep 17 00:00:00 2001 From: Sergio Delgado Quintero Date: Tue, 12 Oct 2021 18:02:20 +0000 Subject: [PATCH 1/5] Add model for allies --- apps/about/admin.py | 13 +++++++++++++ apps/about/migrations/0001_initial.py | 26 ++++++++++++++++++++++++++ apps/about/models.py | 12 ++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 apps/about/admin.py create mode 100644 apps/about/migrations/0001_initial.py create mode 100644 apps/about/models.py diff --git a/apps/about/admin.py b/apps/about/admin.py new file mode 100644 index 00000000..5dd496f4 --- /dev/null +++ b/apps/about/admin.py @@ -0,0 +1,13 @@ +from django.contrib import admin + +from . import models + + +@admin.register(models.Ally) +class AllyAdmin(admin.ModelAdmin): + list_display = ( + 'name', + 'url', + 'twitter', + 'email', + ) diff --git a/apps/about/migrations/0001_initial.py b/apps/about/migrations/0001_initial.py new file mode 100644 index 00000000..f9968f08 --- /dev/null +++ b/apps/about/migrations/0001_initial.py @@ -0,0 +1,26 @@ +# Generated by Django 2.2.24 on 2021-10-12 17:37 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Ally', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=120, verbose_name='Nombre')), + ('description', models.CharField(max_length=220, verbose_name='Descripción')), + ('logo', models.ImageField(blank=True, upload_to='about/allies/')), + ('url', models.URLField(blank=True)), + ('twitter', models.URLField(blank=True)), + ('email', models.EmailField(blank=True, max_length=254)), + ], + ), + ] diff --git a/apps/about/models.py b/apps/about/models.py new file mode 100644 index 00000000..58b6aec6 --- /dev/null +++ b/apps/about/models.py @@ -0,0 +1,12 @@ +from django.db import models + + +class Ally(models.Model): + '''Organizaciones/Asociaciones aliadas''' + + name = models.CharField('Nombre', max_length=120) + description = models.CharField('Descripción', max_length=220) + logo = models.ImageField(upload_to='about/allies/', blank=True) + url = models.URLField(blank=True) + twitter = models.URLField(blank=True) + email = models.EmailField(blank=True) From ce70b3faf5655b2496fc64ad1c4c142c3a4d0cc3 Mon Sep 17 00:00:00 2001 From: Sergio Delgado Quintero Date: Tue, 12 Oct 2021 19:36:34 +0000 Subject: [PATCH 2/5] Render allies in template --- apps/about/models.py | 6 ++++ apps/about/static/about/css/allies.scss | 21 ++++++++++++++ apps/about/static/about/css/main.scss | 6 ++-- apps/about/templates/about/allies.html | 37 +++++++++++++++++++++++++ apps/about/urls.py | 1 + apps/about/views.py | 7 +++++ apps/commons/templates/header.html | 1 + 7 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 apps/about/static/about/css/allies.scss create mode 100644 apps/about/templates/about/allies.html diff --git a/apps/about/models.py b/apps/about/models.py index 58b6aec6..5f9ca1ee 100644 --- a/apps/about/models.py +++ b/apps/about/models.py @@ -10,3 +10,9 @@ class Ally(models.Model): url = models.URLField(blank=True) twitter = models.URLField(blank=True) email = models.EmailField(blank=True) + + def __str__(self): + return self.name + + class Meta: + ordering = ['name'] diff --git a/apps/about/static/about/css/allies.scss b/apps/about/static/about/css/allies.scss new file mode 100644 index 00000000..721edf4d --- /dev/null +++ b/apps/about/static/about/css/allies.scss @@ -0,0 +1,21 @@ +.ally-block { + margin-bottom: 2rem; + img { + width: 5rem; + vertical-align: middle; + } + p.description { + i.quote { + color: gray; + } + } + ul { + list-style-type: none; + margin-left: 1rem; + padding-left: 1rem; + border-left: 2px solid lightgray; + i { + width: 1.5rem; + } + } +} diff --git a/apps/about/static/about/css/main.scss b/apps/about/static/about/css/main.scss index 71c3dd65..68dd4eb2 100644 --- a/apps/about/static/about/css/main.scss +++ b/apps/about/static/about/css/main.scss @@ -1,9 +1,11 @@ @import 'apps/commons/static/commons/css/base'; +@import './allies'; + .about-index { p { - padding-top: .5rem; - padding-bottom: .5rem; + padding-top: 0.5rem; + padding-bottom: 0.5rem; } .message a.headerlink { diff --git a/apps/about/templates/about/allies.html b/apps/about/templates/about/allies.html new file mode 100644 index 00000000..82b3f945 --- /dev/null +++ b/apps/about/templates/about/allies.html @@ -0,0 +1,37 @@ +{% extends "about/base.html" %} +{% load utils %} +{% load static %} + +{% block title %}Aliados - {{ block.super }}{% endblock %} + +{% block content %} + +
+ +

Aliados

+ +

+Canarias es un territorio muy prolífico en el campo de las nuevas tecnologías. Las organizaciones y asociaciones de este sector constituyen un punto de entrada para muchos usuarios y usuarias. Aquello de que la unión hace la fuerza es un principio que seguimos desde Python Canarias. Si bien apostamos, como era de esperar, por nuestro lenguaje de programación favorito, somos una comunidad abierta y nos encanta construir sinergias con otros grupos. Aquí les dejamos un listado de nuestros aliados: +

+ +{% for ally in allies %} +
+

{{ ally.name }}

+

{{ ally.description }}

+ +
+{% endfor %} + +
+ +{% endblock content %} diff --git a/apps/about/urls.py b/apps/about/urls.py index 58ebebc2..d9c0caab 100644 --- a/apps/about/urls.py +++ b/apps/about/urls.py @@ -9,4 +9,5 @@ path('us/', views.us, name='us'), path('join/', views.join, name='join'), path('history/', views.history, name='history'), + path('allies/', views.allies, name='allies'), ] diff --git a/apps/about/views.py b/apps/about/views.py index 91eae738..e037d9e0 100644 --- a/apps/about/views.py +++ b/apps/about/views.py @@ -4,6 +4,8 @@ from apps.members.models import Position +from .models import Ally + logger = logging.getLogger(__name__) @@ -28,3 +30,8 @@ def join(request): def history(request): return render(request, 'about/history.html', {}) + + +def allies(request): + allies = Ally.objects.all() + return render(request, 'about/allies.html', {'allies': allies}) diff --git a/apps/commons/templates/header.html b/apps/commons/templates/header.html index c398fdbe..9f932706 100644 --- a/apps/commons/templates/header.html +++ b/apps/commons/templates/header.html @@ -24,6 +24,7 @@ Información Historia ¡Únete! + Aliados