-
-
Notifications
You must be signed in to change notification settings - Fork 954
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add local Django community page (#1371)
* Add django-countries requirement This django package provides the equivalent of a choice field containing a list of all the countries in the world. This will be used when adding a Local Django Community to the new section of the community page. * Add LocalDjangoCommunity model This model facilitates the listing of local django communities from around the world. This will be listed on a page within the community section of the website. * Add Local Django Communities page to the community section This change adds the local django communities page to the communities section of djangoproject.com * Fix accessibility community page and add empty case * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Sarah Abderemane <sarahabderemane@gmail.com>
- Loading branch information
1 parent
44dd5a8
commit dfa7429
Showing
10 changed files
with
189 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Generated by Django 3.2.19 on 2023-06-05 03:45 | ||
|
||
from django.db import migrations, models | ||
import django_countries.fields | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('aggregator', '0003_increase_url_max_length'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='LocalDjangoCommunity', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('name', models.CharField(max_length=120)), | ||
('description', models.TextField()), | ||
('slug', models.SlugField(max_length=125)), | ||
('city', models.CharField(max_length=85)), | ||
('country', django_countries.fields.CountryField(max_length=2)), | ||
('continent', models.CharField(choices=[('Africa', 'Africa'), ('North America', 'North America'), ('South America', 'South America'), ('Europe', 'Europe'), ('Asia', 'Asia'), ('Oceania', 'Oceania'), ('Antarctica', 'Antarctica')], max_length=15)), | ||
('website_url', models.URLField(blank=True, default=None, max_length=250, null=True)), | ||
('event_site_url', models.URLField(blank=True, default=None, max_length=250, null=True)), | ||
('is_active', models.BooleanField(default=True)), | ||
('created_at', models.DateTimeField(auto_now_add=True)), | ||
], | ||
), | ||
migrations.AddConstraint( | ||
model_name='localdjangocommunity', | ||
constraint=models.CheckConstraint(check=models.Q(models.Q(('event_site_url__isnull', False), ('website_url__isnull', False)), models.Q(('event_site_url__isnull', False), ('website_url__isnull', True)), models.Q(('event_site_url__isnull', True), ('website_url__isnull', False)), _connector='OR'), name='website_url_and_or_event_site_url'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
djangoproject/templates/aggregator/local-django-community.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
{% extends "base_community.html" %} | ||
|
||
{% block content %} | ||
|
||
{# Group meetups by country and then by location #} | ||
{% regroup django_communities|dictsort:"continent" by continent as grouped_django_communities %} | ||
|
||
|
||
<h2>Local Django Communities</h2> | ||
|
||
{% if grouped_django_communities %}<h3>Table of contents<a class="plink" href="#table-of-contents"> ¶</a></h3>{% endif %} | ||
<ul> | ||
{% for local_django_community in grouped_django_communities %} | ||
<li><a href="#{{ local_django_community.grouper.title }}-meetups">{{ local_django_community.grouper.title }}</a></li> | ||
{% endfor %} | ||
</ul> | ||
|
||
|
||
{% for local_django_community in grouped_django_communities %} | ||
<div class="section"> | ||
<h2>{{ local_django_community.grouper.title }} <a class="plink" href="#{{ local_django_community.grouper.title | lower }}-meetups">¶</a></h2> | ||
<ul> | ||
{% for django_community in local_django_community.list %} | ||
<li> | ||
<h3 id="{{ django_community.slug }}-team">{{ django_community.name }} <a class="plink" href="#{{ django_community.slug }}-meetup">¶</a></h3> | ||
<p class="meta">{{ django_community.city }}, {{ django_community.country }} | ||
{% if django_community.is_active %} | ||
Active | ||
{% else %} | ||
Inactive | ||
{% endif %} | ||
</p> | ||
<p>{{ django_community.description|safe }}</p> | ||
<p> | ||
{% if django_community.website_url %} | ||
<a href="{{ django_community.website_url }}">Community Website</a> | ||
{% endif %} | ||
{% if django_community.event_site_url %} | ||
<a href="{{ django_community.event_site_url }}">Event Website</a> | ||
{% endif %} | ||
</p> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
</div> | ||
{% empty %} | ||
Local Django communities are coming soon. Please check back later. | ||
|
||
{% endfor %} | ||
{##} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters