Created
October 10, 2019 00:52
-
-
Save ivan-vilches/8bf5fe72f0d40cefc6efac04c3039b4c to your computer and use it in GitHub Desktop.
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
from django.db import models | |
from wagtail.core.models import Page | |
from wagtail.core.fields import RichTextField | |
from wagtail.admin.edit_handlers import FieldPanel | |
from wagtail.search import index | |
from wagtail.images.edit_handlers import ImageChooserPanel | |
class TallerIndexPage(Page): | |
template = "talleres/talleres_page.html" | |
intro = RichTextField(blank=True) | |
content_panels = Page.content_panels + [ | |
FieldPanel('intro', classname="full") | |
] | |
class Taller(Page): | |
template = "talleres/taller_single_page.html" | |
fechapub = models.DateField("Fecha Inicio Taller", null=True, blank=True) | |
lugar_taller = models.CharField(max_length=150, null=True, blank=True, verbose_name="Lugar donde se realizará el Taller") | |
descripcion = RichTextField(blank=False, null = False, verbose_name="Descripción del Taller") | |
contenido = RichTextField(blank=True, null = True, verbose_name="Todo el contenido extra del taller", default="<p>some HTML here</p>") | |
imagen_taller = models.ForeignKey( | |
"wagtailimages.Image", | |
null=True, | |
blank=True, | |
on_delete=models.SET_NULL, | |
related_name="+", | |
) | |
search_fields = Page.search_fields + [ | |
index.SearchField( | |
'descripcion'), | |
] | |
content_panels = Page.content_panels + [ | |
FieldPanel('fechapub'), | |
FieldPanel('lugar_taller'), | |
FieldPanel('descripcion'), | |
FieldPanel('contenido'), | |
ImageChooserPanel('imagen_taller'), | |
] |
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
{% extends "base.html" %} | |
{% block content %} | |
{% load static %} | |
{% load wagtailcore_tags wagtailimages_tags %} | |
<div class="container titulo-talleres"> | |
<h2>{{ page.title }}</h2> | |
</div> | |
<ul class="gridt"> | |
{% for post in page.get_children %} | |
<li class="grid-item exposiciones"> | |
<article class="post-blogpage"> | |
<div class="image-blogpage"> | |
{% image post.imagen_taller original class="img-fluid" %} | |
</div> | |
<h2> | |
{{ post.title }} | |
</h2> | |
<div class="date">{{post.first_published_at}}</div> | |
<div class="rich-text"> | |
<p> | |
{{ post.descripcion|richtext }} | |
</p> | |
</div> | |
<div class="bottom-post"> | |
<div class="datos-post"> | |
<h3>inicio:{{ post.fechapub }}</h3> | |
<h3>Lugar:{{post.lugar_taller}}</h3> | |
</div> | |
<div class="leer-mas-blogpage"> | |
<a href="single-post.html">leer más</a> | |
</div> | |
</div> | |
</article> | |
</li> | |
{% endfor %} | |
</ul> | |
{% endblock %} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment