コード例 #1
0
ファイル: forms.py プロジェクト: frecar/focus
    def save(self, *args, **kwargs):
        ticket = super(EditTicketForm, self).save(*args, **kwargs)
        ticket_update = TicketUpdate(ticket=ticket,
                                     company=ticket.company,
                                     comment=self.cleaned_data['comment'],
                                     attachment=self.cleaned_data['attachment'],
                                     public=self.cleaned_data['public'])

        if kwargs.get('commit', False):
            ticket_update.save()

        return ticket, ticket_update
コード例 #2
0
ファイル: forms.py プロジェクト: bopopescu/focus
    def save(self, *args, **kwargs):
        ticket = super(EditTicketForm, self).save(*args, **kwargs)
        ticket_update = TicketUpdate(
            ticket=ticket,
            company=ticket.company,
            comment=self.cleaned_data['comment'],
            attachment=self.cleaned_data['attachment'],
            public=self.cleaned_data['public'])

        if kwargs.get('commit', False):
            ticket_update.save()

        return ticket, ticket_update
コード例 #3
0
ファイル: views.py プロジェクト: frecar/focus
def parse(request):

    inbound = PostmarkInbound(json=request.raw_post_data)


    email = Email()

    # content
    email.from_name = inbound.from_name()
    email.from_email = inbound.from_email()
    email.to = inbound.to()

    try:
        email.bcc =  inbound.bcc()
    except:
        pass

    try:
        email.tag = inbound.tag()
    except:
        pass

    try:
        email.message_id = inbound.message_id()
    except:
        pass

    try:
        email.mailbox_hash = inbound.mailbox_hash()
    except:
        pass

    try:
        email.reply_to = inbound.reply_to()
    except:
        pass

    email.html_body = inbound.html_body()
    email.text_body = inbound.text_body()

    email.subject = inbound.subject()


    try:
        email.save()

        print email.mailbox_hash

        if email.mailbox_hash:
            if Ticket.objects.filter(mailbox_hash=email.mailbox_hash).count() > 0:

                ticket = Ticket.objects.get(mailbox_hash=email.mailbox_hash)

                ticket_update = TicketUpdate(ticket=ticket,
                                             company=ticket.company,
                                             comment=email.text_body,
                                             )

                ticket_update.save()



    except Exception, e:
        print str(e)
コード例 #4
0
def parse(request):

    inbound = PostmarkInbound(json=request.raw_post_data)

    email = Email()

    # content
    email.from_name = inbound.from_name()
    email.from_email = inbound.from_email()
    email.to = inbound.to()

    try:
        email.bcc = inbound.bcc()
    except:
        pass

    try:
        email.tag = inbound.tag()
    except:
        pass

    try:
        email.message_id = inbound.message_id()
    except:
        pass

    try:
        email.mailbox_hash = inbound.mailbox_hash()
    except:
        pass

    try:
        email.reply_to = inbound.reply_to()
    except:
        pass

    email.html_body = inbound.html_body()
    email.text_body = inbound.text_body()

    email.subject = inbound.subject()

    try:
        email.save()

        print email.mailbox_hash

        if email.mailbox_hash:
            if Ticket.objects.filter(
                    mailbox_hash=email.mailbox_hash).count() > 0:

                ticket = Ticket.objects.get(mailbox_hash=email.mailbox_hash)

                ticket_update = TicketUpdate(
                    ticket=ticket,
                    company=ticket.company,
                    comment=email.text_body,
                )

                ticket_update.save()

    except Exception, e:
        print str(e)