本文整理汇总了Python中messages.models.Message.accessibles_par方法的典型用法代码示例。如果您正苦于以下问题:Python Message.accessibles_par方法的具体用法?Python Message.accessibles_par怎么用?Python Message.accessibles_par使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类messages.models.Message
的用法示例。
在下文中一共展示了Message.accessibles_par方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: messages
# 需要导入模块: from messages.models import Message [as 别名]
# 或者: from messages.models.Message import accessibles_par [as 别名]
def messages(request, association_pseudo):
association = get_object_or_404(Association,pseudo=association_pseudo)
if association.est_cachee_a(request.user.get_profile()):
return redirect(index)
membres = Adhesion.objects.filter(association__pseudo = association_pseudo).order_by('-ordre', 'eleve__last_name')
list_messages = Message.accessibles_par(request.user.get_profile()).filter(association__pseudo=association_pseudo).order_by('-date')
return render_to_response('association/messages.html', {'association' : association, 'list_messages': list_messages, 'membres': membres},context_instance=RequestContext(request))
示例2: tous
# 需要导入模块: from messages.models import Message [as 别名]
# 或者: from messages.models.Message import accessibles_par [as 别名]
def tous(request):
all_messages = Message.accessibles_par(request.user.get_profile())
paginator = Paginator(all_messages, 15)
page = request.GET.get('page')
try:
list_messages = paginator.page(page)
except PageNotAnInteger:
list_messages = paginator.page(1)
except EmptyPage:
list_messages = paginator.page(paginator.num_pages)
return render_to_response('messages/tous.html', {'list_messages': list_messages},context_instance=RequestContext(request))
示例3: index_json
# 需要导入模块: from messages.models import Message [as 别名]
# 或者: from messages.models.Message import accessibles_par [as 别名]
def index_json(request):
eleve = request.user.get_profile()
list_messages = Message.accessibles_par(eleve).exclude(lu=eleve)
response = HttpResponse(mimetype='application/json')
response.write(simplejson.dumps([{
'id': m.id,
'association': m.association.nom,
'association_pseudo': m.association.pseudo,
'objet': m.objet,
'contenu': m.html_to_text(),
'date': str(m.date.day)+'/'+str(m.date.month)+'/'+str(m.date.year)+ " " + str(m.date.hour) + ":" + str(m.date.minute),
'expediteur': m.expediteur.user.username,
'important': request.user.get_profile() in m.important.all()
} for m in list_messages]))
return response
示例4: index
# 需要导入模块: from messages.models import Message [as 别名]
# 或者: from messages.models.Message import accessibles_par [as 别名]
def index(request):
#On sélectionne les messages publics, et les messages dont l'utilisateur fait partie de l'assoce expeditrice, ou de l'assoce destinataires.
if not request.user.is_authenticated():
return render_to_response('accueil/accueil.html', {},context_instance=RequestContext(request))
else:
eleve = request.user.get_profile()
list_messages = Message.accessibles_par(eleve).exclude(lu=eleve)
paginator = Paginator(list_messages, 15)
page = request.GET.get('page')
try:
list_messages = paginator.page(page)
except PageNotAnInteger:
list_messages = paginator.page(1)
except EmptyPage:
list_messages = paginator.page(paginator.num_pages)
return render_to_response('messages/index.html', {'list_messages': list_messages},context_instance=RequestContext(request))
示例5: search
# 需要导入模块: from messages.models import Message [as 别名]
# 或者: from messages.models.Message import accessibles_par [as 别名]
def search(request):
query_string = ""
found_messages = None
found_users = None
if ("q" in request.GET) and request.GET["q"].strip():
query_string = request.GET["q"]
message_query = get_query(query_string, ["objet", "contenu"])
user_query = get_query(query_string, ["first_name", "last_name", "phone", "chambre", "user__username"])
found_messages = Message.accessibles_par(request.user.get_profile()).filter(message_query).order_by("-date")
found_users = UserProfile.objects.filter(user_query).order_by("user__username")
if query_string.lower() == "dieu":
found_users = UserProfile.objects.filter(user__username="11leuren")
return render_to_response(
"recherche/resultats.html",
{"query_string": query_string, "list_messages": found_messages, "list_users": found_users},
context_instance=RequestContext(request),
)
示例6: render
# 需要导入模块: from messages.models import Message [as 别名]
# 或者: from messages.models.Message import accessibles_par [as 别名]
def render(self, context):
eleve = UserProfile.objects.get(user__username = self.login.resolve(context))
context['nombre_de_messages'] = Message.accessibles_par(eleve).exclude(lu = eleve).count()
return ''
示例7: importants
# 需要导入模块: from messages.models import Message [as 别名]
# 或者: from messages.models.Message import accessibles_par [as 别名]
def importants(request):
eleve = request.user.get_profile()
list_messages = Message.accessibles_par(eleve).filter(important=eleve)
return render_to_response('messages/importants.html', {'list_messages': list_messages},context_instance=RequestContext(request))