From 340178e13cd3108d83fda90d8b3931fa44dcaaac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A1tia=20Nakamura?= Date: Fri, 3 Aug 2018 20:18:04 +0200 Subject: [PATCH] core: add country to person model and flag to the templates --- pyconbalkan/conference/templates/home.html | 3 +++ pyconbalkan/core/models.py | 2 ++ .../core/static/css/components/flag.css | 9 +++++++++ pyconbalkan/core/templates/base.html | 2 ++ .../migrations/0013_volunteer_country.py | 19 +++++++++++++++++++ .../organizers/templates/organizer.html | 6 ++++-- .../organizers/templates/organizers.html | 6 ++++++ .../migrations/0010_speaker_country.py | 19 +++++++++++++++++++ pyconbalkan/speaker/templates/speaker.html | 7 +++++-- 9 files changed, 69 insertions(+), 4 deletions(-) create mode 100644 pyconbalkan/core/static/css/components/flag.css create mode 100644 pyconbalkan/organizers/migrations/0013_volunteer_country.py create mode 100644 pyconbalkan/speaker/migrations/0010_speaker_country.py diff --git a/pyconbalkan/conference/templates/home.html b/pyconbalkan/conference/templates/home.html index a55488f3..40220d0f 100644 --- a/pyconbalkan/conference/templates/home.html +++ b/pyconbalkan/conference/templates/home.html @@ -61,6 +61,9 @@

Keynote Speakers

{{ keynote.name }} + {% if keynote.country %} + + {% endif %}

diff --git a/pyconbalkan/core/models.py b/pyconbalkan/core/models.py index b50b69f3..18d74100 100644 --- a/pyconbalkan/core/models.py +++ b/pyconbalkan/core/models.py @@ -1,4 +1,5 @@ from django.db import models +from django_countries.fields import CountryField from markdownx.models import MarkdownxField from slugify import slugify @@ -18,6 +19,7 @@ class Person(models.Model): slug = models.CharField(unique=True, blank=True, max_length=100) description = MarkdownxField(blank=True, default='') email = models.EmailField(blank=True, null=True) + country = CountryField(null=True, blank=True) def save(self, *args, **kwargs): if not self.slug: diff --git a/pyconbalkan/core/static/css/components/flag.css b/pyconbalkan/core/static/css/components/flag.css new file mode 100644 index 00000000..3474f9a2 --- /dev/null +++ b/pyconbalkan/core/static/css/components/flag.css @@ -0,0 +1,9 @@ +/* + * Flag + * Usually


elements representing a line. + */ + +i.flag { + height: 1.0em; + width: 1.0em; +} \ No newline at end of file diff --git a/pyconbalkan/core/templates/base.html b/pyconbalkan/core/templates/base.html index 3279bce2..a2009405 100644 --- a/pyconbalkan/core/templates/base.html +++ b/pyconbalkan/core/templates/base.html @@ -29,6 +29,7 @@ + @@ -40,6 +41,7 @@ + diff --git a/pyconbalkan/organizers/migrations/0013_volunteer_country.py b/pyconbalkan/organizers/migrations/0013_volunteer_country.py new file mode 100644 index 00000000..6a1ef23c --- /dev/null +++ b/pyconbalkan/organizers/migrations/0013_volunteer_country.py @@ -0,0 +1,19 @@ +# Generated by Django 2.0.5 on 2018-08-03 15:06 + +from django.db import migrations +import django_countries.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('organizers', '0012_auto_20180801_2318'), + ] + + operations = [ + migrations.AddField( + model_name='volunteer', + name='country', + field=django_countries.fields.CountryField(blank=True, max_length=2, null=True), + ), + ] diff --git a/pyconbalkan/organizers/templates/organizer.html b/pyconbalkan/organizers/templates/organizer.html index 2030f593..f32dba96 100644 --- a/pyconbalkan/organizers/templates/organizer.html +++ b/pyconbalkan/organizers/templates/organizer.html @@ -7,10 +7,12 @@
-
-

{{ organizer.name }}

+

+ {{ organizer.name }} + {% if organizer.country %}{% endif %} +

{{ organizer.job }}

diff --git a/pyconbalkan/organizers/templates/organizers.html b/pyconbalkan/organizers/templates/organizers.html index 0c027bc4..dab0167c 100644 --- a/pyconbalkan/organizers/templates/organizers.html +++ b/pyconbalkan/organizers/templates/organizers.html @@ -17,6 +17,9 @@

Organizers

{{ organizer.name }} + {% if organizer.country %} + + {% endif %}

{% if organizer.job %} @@ -49,6 +52,9 @@

Volunteers

{{ volunteer.name }} + {% if volunteer.country %} + + {% endif %}

{% if volunteer.job %}

diff --git a/pyconbalkan/speaker/migrations/0010_speaker_country.py b/pyconbalkan/speaker/migrations/0010_speaker_country.py new file mode 100644 index 00000000..2162703c --- /dev/null +++ b/pyconbalkan/speaker/migrations/0010_speaker_country.py @@ -0,0 +1,19 @@ +# Generated by Django 2.0.5 on 2018-08-03 15:06 + +from django.db import migrations +import django_countries.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('speaker', '0009_auto_20180801_2318'), + ] + + operations = [ + migrations.AddField( + model_name='speaker', + name='country', + field=django_countries.fields.CountryField(blank=True, max_length=2, null=True), + ), + ] diff --git a/pyconbalkan/speaker/templates/speaker.html b/pyconbalkan/speaker/templates/speaker.html index 871ac182..82420644 100644 --- a/pyconbalkan/speaker/templates/speaker.html +++ b/pyconbalkan/speaker/templates/speaker.html @@ -7,10 +7,13 @@

-
+
-

{{ speaker.name }}

+

+ {{ speaker.name }} + {% if speaker.country %}{% endif %} +

{{ speaker.job }}

{{ speaker.description|safe }}