Exemplo n.º 1
0
 def save(self):
     post = super(AdminPostForm, self).save(commit=False)
     
     if post.pk is None:
         if self.cleaned_data["publish"]:
             post.published = datetime.now()
     else:
         if Post.objects.filter(pk=post.pk, published=None).count():
             if self.cleaned_data["publish"]:
                 post.published = datetime.now()
     
     post.teaser_html = parse(self.cleaned_data["teaser"], emitter=BiblionHtmlEmitter)
     post.content_html = parse(self.cleaned_data["content"], emitter=BiblionHtmlEmitter)
     post.updated = datetime.now()
     post.save()
     
     r = Revision()
     r.post = post
     r.title = post.title
     r.teaser = self.cleaned_data["teaser"]
     r.content = self.cleaned_data["content"]
     r.author = post.author
     r.updated = post.updated
     r.published = post.published
     r.save()
     
     if can_tweet() and self.cleaned_data["tweet"]:
         post.tweet()
     
     return post
Exemplo n.º 2
0
 def save(self):
     post = super(AdminPostForm, self).save(commit=False)
     
     if post.pk is None:
         if self.cleaned_data["publish"]:
             post.published = datetime.now()
     else:
         if Post.objects.filter(pk=post.pk, published=None).count():
             if self.cleaned_data["publish"]:
                 post.published = datetime.now()
     
     post.teaser_html = parse(self.cleaned_data["teaser"], emitter=BiblionHtmlEmitter)
     post.content_html = parse(self.cleaned_data["content"], emitter=BiblionHtmlEmitter)
     post.updated = datetime.now()
     post.save()
     
     r = Revision()
     r.post = post
     r.title = post.title
     r.teaser = self.cleaned_data["teaser"]
     r.content = self.cleaned_data["content"]
     r.author = post.author
     r.updated = post.updated
     r.published = post.published
     r.save()
     
     if can_tweet() and self.cleaned_data["tweet"]:
         post.tweet()
     
     return post
Exemplo n.º 3
0
 def save(self, **kwargs):
     if self.vote:
         vote, created = LatestVote.objects.get_or_create(
             proposal=self.proposal, user=self.user, defaults=dict(vote=self.vote, submitted_at=self.submitted_at)
         )
         if not created:
             LatestVote.objects.filter(pk=vote.pk).update(vote=self.vote)
             self.proposal.result.update_vote(self.vote, previous=vote.vote)
         else:
             self.proposal.result.update_vote(self.vote)
     self.comment_html = creole_parser.parse(self.comment)
     super(Review, self).save(**kwargs)
Exemplo n.º 4
0
 def save(self, **kwargs):
     if self.vote:
         vote, created = LatestVote.objects.get_or_create(
             proposal = self.proposal,
             user = self.user,
             defaults = dict(
                 vote = self.vote,
                 submitted_at = self.submitted_at,
             )
         )
         if not created:
             LatestVote.objects.filter(pk=vote.pk).update(vote=self.vote)
             self.proposal.result.update_vote(self.vote, previous=vote.vote)
         else:
             self.proposal.result.update_vote(self.vote)
     self.comment_html = creole_parser.parse(self.comment)
     super(Review, self).save(**kwargs)
Exemplo n.º 5
0
 def save(self, *args, **kwargs):
     self.abstract_html = creole_parser.parse(self.abstract)
     super(Presentation, self).save(*args, **kwargs)
Exemplo n.º 6
0
def creole_preview(request):
    if "raw" not in request.POST:
        return HttpResponse("no good")
    return HttpResponse(creole_parser.parse(request.POST["raw"]))
Exemplo n.º 7
0
 def save(self, *args, **kwargs):
     self.abstract_html = creole_parser.parse(self.abstract)
     super(Proposal, self).save(*args, **kwargs)
Exemplo n.º 8
0
 def save(self, *args, **kwargs):
     self.biography_html = creole_parser.parse(self.biography)
     super(Speaker, self).save(*args, **kwargs)
Exemplo n.º 9
0
 def save(self, *args, **kwargs):
     self.abstract_html = creole_parser.parse(self.abstract)
     super(Proposal, self).save(*args, **kwargs)
Exemplo n.º 10
0
 def save(self, *args, **kwargs):
     self.biography_html = creole_parser.parse(self.biography)
     super(Speaker, self).save(*args, **kwargs)
Exemplo n.º 11
0
 def save(self, **kwargs):
     self.message_html = creole_parser.parse(self.message)
     super(ProposalMessage, self).save(**kwargs)
Exemplo n.º 12
0
def creole_preview(request):
    if "raw" not in request.POST:
        logger.debug("raw in request.POST: no good")
        return HttpResponse("no good")
    logger.debug("lets debug something")
    return HttpResponse(creole_parser.parse(request.POST["raw"]))
Exemplo n.º 13
0
 def save(self, *args, **kwargs):
     self.abstract_html = creole_parser.parse(self.abstract)
     super(Presentation, self).save(*args, **kwargs)