Skip to content

Commit 2fc61ec

Browse files
authored
Merge pull request #410 from pythoncanarias/129-add-allies
Añade entidades/organizaciones amigas (aliados)
2 parents 2ecd8c0 + 9b37cff commit 2fc61ec

14 files changed

Lines changed: 169 additions & 4 deletions

File tree

apps/about/admin.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from django.contrib import admin
2+
3+
from . import models
4+
5+
6+
@admin.register(models.Ally)
7+
class AllyAdmin(admin.ModelAdmin):
8+
list_display = (
9+
'name',
10+
'url',
11+
'twitter',
12+
'email',
13+
)
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Generated by Django 2.2.24 on 2021-10-12 17:37
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
initial = True
9+
10+
dependencies = [
11+
]
12+
13+
operations = [
14+
migrations.CreateModel(
15+
name='Ally',
16+
fields=[
17+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
18+
('name', models.CharField(max_length=120, verbose_name='Nombre')),
19+
('description', models.CharField(max_length=220, verbose_name='Descripción')),
20+
('logo', models.ImageField(blank=True, upload_to='about/allies/')),
21+
('url', models.URLField(blank=True)),
22+
('twitter', models.URLField(blank=True)),
23+
('email', models.EmailField(blank=True, max_length=254)),
24+
],
25+
),
26+
]

apps/about/models.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from django.db import models
2+
3+
4+
class Ally(models.Model):
5+
'''Organizaciones/Asociaciones aliadas'''
6+
7+
name = models.CharField('Nombre', max_length=120)
8+
description = models.CharField('Descripción', max_length=220)
9+
logo = models.ImageField(upload_to='about/allies/', blank=True)
10+
url = models.URLField(blank=True)
11+
twitter = models.URLField(blank=True)
12+
email = models.EmailField(blank=True)
13+
14+
def __str__(self):
15+
return self.name
16+
17+
class Meta:
18+
ordering = ['name']
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.ally-block {
2+
margin-bottom: 2rem;
3+
img {
4+
width: 5rem;
5+
vertical-align: middle;
6+
}
7+
p.description {
8+
i.quote {
9+
color: gray;
10+
}
11+
}
12+
ul {
13+
list-style-type: none;
14+
margin-left: 1rem;
15+
padding-left: 1rem;
16+
border-left: 2px solid lightgray;
17+
i {
18+
width: 1.5rem;
19+
}
20+
}
21+
}

apps/about/static/about/css/main.scss

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
@import 'apps/commons/static/commons/css/base';
22

3+
@import './allies';
4+
35
.about-index {
46
p {
5-
padding-top: .5rem;
6-
padding-bottom: .5rem;
7+
padding-top: 0.5rem;
8+
padding-bottom: 0.5rem;
79
}
810

911
.message a.headerlink {
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{% extends "about/base.html" %}
2+
{% load utils %}
3+
{% load static %}
4+
5+
{% block title %}Aliados - {{ block.super }}{% endblock %}
6+
7+
{% block content %}
8+
9+
<div class="content box">
10+
11+
<h1>Aliados</h1>
12+
13+
<p>
14+
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 <b>aliados</b>:
15+
</p>
16+
17+
{% for ally in allies %}
18+
<div class="ally-block" id="{{ ally.name|slugify }}">
19+
<h2 class="dyn-anchor-heading">
20+
<img src="{{ ally.logo.url }}"> {{ ally.name }}
21+
<a class="dyn-anchor-link" href="#{{ ally.name|slugify }}"><i class="fas fa-link"></i></a>
22+
</h2>
23+
<p class="description"><i class="fas fa-quote-left quote"></i> {{ ally.description }} <i class="fas fa-quote-right quote"></i></p>
24+
<ul>
25+
{% if ally.url %}
26+
<li><i class="fas fa-home"></i> <a href="{{ ally.url }}">{{ ally.url }}</a></li>
27+
{% endif %}
28+
{% if ally.twitter %}
29+
<li><i class="fab fa-twitter"></i> <a href="{{ ally.twitter }}">{{ ally.twitter }}</a></li>
30+
{% endif %}
31+
{% if ally.email %}
32+
<li><i class="far fa-envelope"></i> <a href="mailto:{{ ally.email }}">{{ ally.email }}</a></li>
33+
{% endif %}
34+
</ul>
35+
</div>
36+
{% endfor %}
37+
38+
</div>
39+
40+
{% endblock content %}

apps/about/templates/about/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<div class="message-body">
2424
<strong>{{ organization.name }}</strong> es una asociación sin ánimo de lucro cuyos objetivos, son, entre otros, promover el <strong>uso del lenguaje</strong> de programación Python, dar <strong>soporte</strong> a quienes deseen aprenderlo y promover la programación como una <strong>competencia educativa básica</strong>.</p>
2525

26-
<p>La asociación fue creada el <strong>{{ organization.registration_date|date:"d/m/Y" }}</strong> y desde entonces ha organizado <a href="{% url 'events:past_events' %}">diferentes eventos</a> de difusión del lenguaje de programación Python colaborando en el incremento de la comunidad de usuarios de Python en Canarias.</p>
26+
<p>La asociación fue creada el <strong>{{ organization.registration_date|date:"d/m/Y" }}</strong> y desde entonces ha organizado <a href="{% url 'events:past_events' %}">diferentes eventos</a> de difusión del lenguaje de programación Python colaborando en el incremento de la comunidad de usuarios de Python en Canarias y <a href="{% url 'about:allies' %}">sumando aliados</a> por el camino.</p>
2727

2828
<p>Te recomendamos que no dejes de <a href="{% url 'about:history' %}">repasar la historia de Python Canarias</a>.</p>
2929

apps/about/urls.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@
99
path('us/', views.us, name='us'),
1010
path('join/', views.join, name='join'),
1111
path('history/', views.history, name='history'),
12+
path('allies/', views.allies, name='allies'),
1213
]

apps/about/views.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
from apps.members.models import Position
66

7+
from .models import Ally
8+
79
logger = logging.getLogger(__name__)
810

911

@@ -28,3 +30,8 @@ def join(request):
2830

2931
def history(request):
3032
return render(request, 'about/history.html', {})
33+
34+
35+
def allies(request):
36+
allies = Ally.objects.all()
37+
return render(request, 'about/allies.html', {'allies': allies})

apps/commons/static/commons/css/base.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@import './variables';
22
@import '~bulma/bulma.sass';
33
@import './override';
4+
@import './dyn-anchors';
45

56
html {
67
// source: https://stackoverflow.com/q/46463338
@@ -122,4 +123,4 @@ body {
122123
border-radius: 22.5px;
123124
border-color: $header-bg;
124125
background-color: whitesmoke;
125-
}
126+
}

0 commit comments

Comments
 (0)