def emails(request): current = 'emails'; title = u'设置 / 邮箱' useremails = GsuserManager.list_useremail_by_userId(request.user.id) response_dictionary = {'current': current, 'title': title, 'useremails': useremails} return render_to_response('settings/emails.html', response_dictionary, context_instance=RequestContext(request))
def notif(request): current = 'notif'; title = u'设置 / 通知' notifSetting = FeedManager.get_notifsetting_by_userId(request.user.id) useremails = GsuserManager.list_useremail_by_userId(request.user.id) response_dictionary = {'current': current, 'title': title, 'notif_type_choice': NOTIF_TYPE.NOTIF_TYPE_CHOICE, 'notif_fqcy_choice': NOTIF_FQCY.NOTIF_FQCY_CHOICE, 'notifSetting': notifSetting, 'useremails': useremails} return render_to_response('settings/notif.html', response_dictionary, context_instance=RequestContext(request))
def email_primary(request, eid): usermail = GsuserManager.get_useremail_by_id(eid) if not usermail or usermail.user_id != request.user.id: return json_failed(500, u'设置失败,没有权限') useremails = GsuserManager.list_useremail_by_userId(request.user.id) for x in useremails: if usermail.id != x.id and x.is_primary == 1: x.is_primary = 0 x.save() usermail.is_primary = 1 usermail.save() return json_success(u'成功设置默认邮箱 %s' % usermail.email)
def emails(request): current = 'emails' title = u'设置 / 邮箱' useremails = GsuserManager.list_useremail_by_userId(request.user.id) response_dictionary = { 'current': current, 'title': title, 'useremails': useremails } return render_to_response('settings/emails.html', response_dictionary, context_instance=RequestContext(request))
def email_primary(request, eid): usermail = GsuserManager.get_useremail_by_id(eid) if not usermail or usermail.user_id != request.user.id: return json_failed(500, u'设置失败,没有权限') useremails = GsuserManager.list_useremail_by_userId(request.user.id) for x in useremails: if usermail.id != x.id and x.is_primary == 1: x.is_primary = 0 x.save() usermail.is_primary = 1 usermail.save() return json_success(u'成功设置默认邮箱 %s' % usermail.email)
def notif(request): current = 'notif' title = u'设置 / 通知' notifSetting = FeedManager.get_notifsetting_by_userId(request.user.id) useremails = GsuserManager.list_useremail_by_userId(request.user.id) response_dictionary = { 'current': current, 'title': title, 'notif_type_choice': NOTIF_TYPE.NOTIF_TYPE_CHOICE, 'notif_fqcy_choice': NOTIF_FQCY.NOTIF_FQCY_CHOICE, 'notifSetting': notifSetting, 'useremails': useremails } return render_to_response('settings/notif.html', response_dictionary, context_instance=RequestContext(request))