diff --git a/fet2020/documents/api.py b/fet2020/documents/api.py index 3f0f63a7..206a12af 100644 --- a/fet2020/documents/api.py +++ b/fet2020/documents/api.py @@ -27,7 +27,15 @@ class ep_api(): raise e self.group = None self.epc = None - + + def getPadHTML(self, padID): + self.get_epc() + text=self.epc.getHTML(padID=self.group["groupID"] + "$" + padID)["html"] + return text + def setPadHTML(self, padID,html): + self.get_epc() + text=self.epc.setHTML(padID=self.group["groupID"] + "$" + padID, html=html) + return html def checkPadExists(self, padID=None): print(self.epc.listPads(groupID=self.group["groupID"])) if not padID: diff --git a/fet2020/posts/forms.py b/fet2020/posts/forms.py index 838a976d..0494b230 100644 --- a/fet2020/posts/forms.py +++ b/fet2020/posts/forms.py @@ -88,6 +88,7 @@ class MyEventForm(MyPostForm): class MyFetMeetingForm(MyEventForm): + #agenda_html = forms.CharField(widget = forms.TextInput()) class Meta: model = FetMeeting diff --git a/fet2020/posts/models.py b/fet2020/posts/models.py index 857d37f8..e8785be3 100644 --- a/fet2020/posts/models.py +++ b/fet2020/posts/models.py @@ -103,11 +103,19 @@ class Post(models.Model): return ",".join(self.tags.names()) @property def agenda_html(self): - return "

Agenda

" + if not self.agenda_key: + return None + h=ep.getPadHTML(self.agenda_key) + return h - #@agenda_html.setter - #def agenda_html_set(self, value): - # return value + @agenda_html.setter + def agenda_html(self, value): + request_logger.info("Accessing etherpad ...") + + h=ep.setPadHTML(self.agenda_key,value) + request_logger.info("set etherpad!") + return value + @property def get_tagnames(self): return ["#%s" % t for t in self.tags.names()] @@ -173,6 +181,7 @@ class Post(models.Model): class PostSerializer(serializers.HyperlinkedModelSerializer): + agenda_html=serializers.CharField() class Meta: model = Post fields = [ @@ -187,7 +196,8 @@ class PostSerializer(serializers.HyperlinkedModelSerializer): 'image', 'event_start', 'event_end', - 'is_hidden', 'agenda_html' + 'is_hidden', + 'agenda_html' # 'author'#, ] diff --git a/fet2020/templates/posts/show.html b/fet2020/templates/posts/show.html index d8053268..de93d517 100644 --- a/fet2020/templates/posts/show.html +++ b/fet2020/templates/posts/show.html @@ -53,7 +53,7 @@ Start: {{post.event_start}}
Ende: {{post.event_end}}
- + {% if post.has_agenda %} Agenda
{% endif %} @@ -73,6 +73,11 @@ {% endfor %}
+ {% if post.has_agenda %} +

Agenda

+ {{post.agenda_html |safe}} + {% endif %} + {{post.body | safe | add_internal_links | tags_to_url}}