本文整理汇总了Python中messages.models.Message.text方法的典型用法代码示例。如果您正苦于以下问题:Python Message.text方法的具体用法?Python Message.text怎么用?Python Message.text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类messages.models.Message
的用法示例。
在下文中一共展示了Message.text方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: show_mail_compose
# 需要导入模块: from messages.models import Message [as 别名]
# 或者: from messages.models.Message import text [as 别名]
def show_mail_compose(self, request):
try:
if request.is_ajax():
mail_sent_complete = False
if request.method == 'POST':
form = ComposeMailForm(request.POST)
if form.is_valid():
new_mail = Message()
user = request.user
new_mail.id_sender = user
user2 = User.objects.get(id= form.cleaned_data['user_id'])
new_mail.id_receiver = user2
new_mail.datetime = datetime.now()
new_mail.id_conversation = 1
new_mail.text = form.cleaned_data['text']
new_mail.subject = form.cleaned_data['subject']
new_mail.save()
form = ComposeMailForm()
mail_sent_complete = MAILSENTCOMPLETE
else:
form = ComposeMailForm()
week = {0:'Lunes',1:'Martes',2:'Miércoles',3:'Jueves',4:'Viernes',5:'Sábado',6:'Domingo'}
month = {0: 'Enero', 1:'Febrero',2:'Marzo',3:'Abril',4:'Mayo',5:'Junio',6:'Julio',7:'Agosto',8:'Septiembre',9:'Octubre',10:'Noviembre',11:'Diciembre'}
date_time = week[datetime.today().weekday()] + " " + str(datetime.today().day) + "/" + month[datetime.today().month - 1] + " " + str(datetime.today().year)
c = { 'form': form , 'date_t':date_time, 'mail_sent_complete' : mail_sent_complete}
c.update(csrf(request))
return render_to_response('user_send_mail.html', c)
else: return HttpResponseRedirect("/usuarios/profile/mail")
except Exception as e: return self.show_error(e)