add flatpages
This commit is contained in:
@@ -165,11 +165,18 @@ class FetMeetingForm(PostForm):
|
||||
|
||||
|
||||
class PostSearchForm(forms.Form):
|
||||
year_of_first_post = Post.objects.get_queryset().last().public_date.year
|
||||
years = range(year_of_first_post, timezone.now().date().year + 1)
|
||||
|
||||
year_choices = [('', _('Alle'))] + [(i, i) for i in years]
|
||||
year_choices = [('', _('Alle'))]
|
||||
month_choices = [('', _('Alle'))] + list(MONTHS.items())
|
||||
|
||||
try:
|
||||
first_post = Post.objects.get_queryset().last()
|
||||
|
||||
if first_post:
|
||||
year_of_first_post = first_post.public_date.year
|
||||
years = range(year_of_first_post, timezone.now().date().year + 1)
|
||||
year_choices += [(i, i) for i in years]
|
||||
except:
|
||||
pass
|
||||
|
||||
year = forms.ChoiceField(label="Jahr", choices=year_choices, required=False)
|
||||
month = forms.ChoiceField(label="Monat", choices=month_choices, required=False)
|
||||
|
||||
@@ -1,15 +1,18 @@
|
||||
import re
|
||||
import logging
|
||||
from urllib.request import URLError
|
||||
|
||||
from datetime import timedelta
|
||||
from django.contrib.auth.models import User
|
||||
from django.core.validators import ValidationError
|
||||
from django.db import models
|
||||
from django.template.loader import render_to_string
|
||||
from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
from django.utils.text import slugify
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from taggit.managers import TaggableManager
|
||||
|
||||
from core.models import CustomFlatPage
|
||||
from documents import getPadHTML, setPadHTML, createPadifNotExists
|
||||
from .managers import (
|
||||
PostManager,
|
||||
@@ -26,7 +29,14 @@ request_logger = logging.getLogger("django.request")
|
||||
|
||||
def create_pad_for_post(slug, typ="agenda"):
|
||||
"Creates a Etherpad Pad and returns EtherpadKey"
|
||||
return createPadifNotExists(slug + "-" + typ)
|
||||
padID = createPadifNotExists(slug + "-" + typ)
|
||||
|
||||
if padID:
|
||||
page = CustomFlatPage.objects.filter(title__iexact=typ).first()
|
||||
if page:
|
||||
setPadHTML(padID, page.content)
|
||||
|
||||
return padID
|
||||
|
||||
|
||||
class Category(models.Model):
|
||||
|
||||
Reference in New Issue
Block a user