示例#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
示例#2
0
文件: forms.py 项目: akaihola/biblion
 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
示例#3
0
文件: models.py 项目: pytexas/pycon
 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)
示例#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)
示例#5
0
 def save(self, *args, **kwargs):
     self.abstract_html = creole_parser.parse(self.abstract)
     super(Presentation, self).save(*args, **kwargs)
示例#6
0
def creole_preview(request):
    if "raw" not in request.POST:
        return HttpResponse("no good")
    return HttpResponse(creole_parser.parse(request.POST["raw"]))
示例#7
0
文件: models.py 项目: MechanisM/pycon
 def save(self, *args, **kwargs):
     self.abstract_html = creole_parser.parse(self.abstract)
     super(Proposal, self).save(*args, **kwargs)
示例#8
0
 def save(self, *args, **kwargs):
     self.biography_html = creole_parser.parse(self.biography)
     super(Speaker, self).save(*args, **kwargs)
示例#9
0
 def save(self, *args, **kwargs):
     self.abstract_html = creole_parser.parse(self.abstract)
     super(Proposal, self).save(*args, **kwargs)
示例#10
0
文件: models.py 项目: MechanisM/pycon
 def save(self, *args, **kwargs):
     self.biography_html = creole_parser.parse(self.biography)
     super(Speaker, self).save(*args, **kwargs)
示例#11
0
 def save(self, **kwargs):
     self.message_html = creole_parser.parse(self.message)
     super(ProposalMessage, self).save(**kwargs)
示例#12
0
文件: views.py 项目: NelleV/Pyconfr
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"]))
示例#13
0
 def save(self, *args, **kwargs):
     self.abstract_html = creole_parser.parse(self.abstract)
     super(Presentation, self).save(*args, **kwargs)