diff --git a/blog/content/materials.yml b/blog/content/materials.yml new file mode 100644 index 0000000..1b716ae --- /dev/null +++ b/blog/content/materials.yml @@ -0,0 +1,2 @@ +- title: PyLadies Brasil Handbook + link: https://brazilpyladies.gitbooks.io/handbook/content/ diff --git a/blog/templates/blog/ladies.html b/blog/templates/blog/ladies.html index b6a9fa2..30440b7 100644 --- a/blog/templates/blog/ladies.html +++ b/blog/templates/blog/ladies.html @@ -20,7 +20,7 @@

LADIES

{% if lady.url %} - + {{ lady.name }} @@ -31,7 +31,7 @@

LADIES

{% for item in medias %} {% if item in lady %} - + diff --git a/blog/templates/blog/materials.html b/blog/templates/blog/materials.html new file mode 100644 index 0000000..a758c47 --- /dev/null +++ b/blog/templates/blog/materials.html @@ -0,0 +1,36 @@ +{% extends 'blog/layouts/page.html' %} + +{% block title %}Pyladies DF - Materiais{% endblock %} + +{% block content %} +
+
+

MATERIAIS

+
+
+ +
+
+{% endblock %} diff --git a/blog/urls.py b/blog/urls.py index a6d3449..a1b3e55 100644 --- a/blog/urls.py +++ b/blog/urls.py @@ -1,12 +1,12 @@ from django.urls import path -from blog.views import Home, ListLadies +from blog.views import Home, ListLadies, ListMaterials app_name = 'blog' urlpatterns = [ path('', Home.as_view(), name='about'), path('ladies/', ListLadies.as_view(), name='ladies'), - path('material', Home.as_view(), name='material'), + path('materials/', ListMaterials.as_view(), name='material'), path('blog/', Home.as_view(), name='blog'), ] diff --git a/blog/views.py b/blog/views.py index 758e5cd..5ede88c 100644 --- a/blog/views.py +++ b/blog/views.py @@ -27,3 +27,16 @@ def get_queryset(self): except yaml.YAMLError as exc: ladies = [] return ladies + + +class ListMaterials(ListView): + template_name = 'blog/materials.html' + context_object_name = 'materials' + + def get_queryset(self): + with open(f'{Path(__file__).parents[0]}/content/materials.yml', 'r') as stream: + try: + materials = yaml.load(stream) + except yaml.YAMLError as exc: + materials = [] + return materials