defaults moved to save from clean + docstrings
This commit is contained in:
@@ -25,6 +25,8 @@ request_logger = logging.getLogger("django.request")
|
|||||||
|
|
||||||
|
|
||||||
def create_pad_for_post(slug, typ="agenda"):
|
def create_pad_for_post(slug, typ="agenda"):
|
||||||
|
"Creates a Etherpad Pad and returns EtherpadKey"
|
||||||
|
print("creatingpadforpost")
|
||||||
try:
|
try:
|
||||||
agenda_key = createPadifNotExists(slug + "-" + typ)
|
agenda_key = createPadifNotExists(slug + "-" + typ)
|
||||||
except URLError as error:
|
except URLError as error:
|
||||||
@@ -117,6 +119,7 @@ class Post(models.Model):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def agenda_html(self):
|
def agenda_html(self):
|
||||||
|
"Agenda HTML from Etherpad Pad"
|
||||||
if not self.agenda_key:
|
if not self.agenda_key:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@@ -132,6 +135,7 @@ class Post(models.Model):
|
|||||||
return html
|
return html
|
||||||
@property
|
@property
|
||||||
def protocol_html(self):
|
def protocol_html(self):
|
||||||
|
"Protocol HTML from Etherpad Pad"
|
||||||
if not self.protocol_key:
|
if not self.protocol_key:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@@ -191,13 +195,15 @@ class Post(models.Model):
|
|||||||
return value
|
return value
|
||||||
|
|
||||||
def get_agenda_key(self):
|
def get_agenda_key(self):
|
||||||
"Create a Etherpad Id for the Pad associated to this post. Creates the pad if it doesn't exist"
|
"""Create a Etherpad Id for the Pad associated to this post.
|
||||||
|
Creates the pad if it doesn't exist"""
|
||||||
if not self.slug:
|
if not self.slug:
|
||||||
return None
|
return None
|
||||||
return create_pad_for_post(self.slug, typ="agenda")
|
return create_pad_for_post(self.slug, typ="agenda")
|
||||||
|
|
||||||
def get_protocol_key(self):
|
def get_protocol_key(self):
|
||||||
"Create a Etherpad Id for the Pad associated to this post. Creates the pad if it doesn't exist"
|
"""Create a Etherpad Id for the Pad associated to this post.
|
||||||
|
Creates the pad if it doesn't exist"""
|
||||||
if not self.slug:
|
if not self.slug:
|
||||||
return None
|
return None
|
||||||
return create_pad_for_post(self.slug, typ="protocol")
|
return create_pad_for_post(self.slug, typ="protocol")
|
||||||
@@ -355,24 +361,19 @@ class FetMeeting(Event):
|
|||||||
# ) from error#
|
# ) from error#
|
||||||
#
|
#
|
||||||
# return protocol_key
|
# return protocol_key
|
||||||
|
|
||||||
def clean(self):
|
|
||||||
super().clean()
|
|
||||||
|
|
||||||
if not self.slug:
|
|
||||||
self.slug = self.__get_slug()
|
|
||||||
|
|
||||||
if self.has_agenda:
|
|
||||||
self.agenda_key = self.get_agenda_key()
|
|
||||||
|
|
||||||
if self.has_protocol:
|
|
||||||
self.protocol_key = self.get_protocol_key()
|
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
self.title = "Fachschaftssitzung"
|
self.title = "Fachschaftssitzung"
|
||||||
|
if not self.slug:
|
||||||
# TODO
|
self.slug = self.__get_slug()
|
||||||
# self.image
|
|
||||||
|
self.has_agenda = True
|
||||||
|
self.has_protocol = True
|
||||||
|
|
||||||
|
self.agenda_key = self.get_agenda_key()
|
||||||
|
self.protocol_key = self.get_protocol_key()
|
||||||
|
|
||||||
if not self.post_type:
|
if not self.post_type:
|
||||||
self.post_type = "F"
|
self.post_type = "F"
|
||||||
|
|||||||
Reference in New Issue
Block a user