当前位置: 首页>>代码示例>>Python>>正文


Python Message.accessibles_par方法代码示例

本文整理汇总了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))
开发者ID:ensmp,项目名称:portail,代码行数:9,代码来源:views.py

示例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))
开发者ID:ensmp,项目名称:portail,代码行数:15,代码来源:views.py

示例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
开发者ID:ensmp,项目名称:portail,代码行数:17,代码来源:views.py

示例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))
开发者ID:ensmp,项目名称:portail,代码行数:18,代码来源:views.py

示例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),
    )
开发者ID:wumzi,项目名称:portail,代码行数:21,代码来源:views.py

示例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 ''
开发者ID:ensmp,项目名称:portail,代码行数:6,代码来源:obtenir_nombre_messages.py

示例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))
开发者ID:ensmp,项目名称:portail,代码行数:6,代码来源:views.py


注:本文中的messages.models.Message.accessibles_par方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。