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


Python Contact.get_by_user方法代码示例

本文整理汇总了Python中models.Contact.get_by_user方法的典型用法代码示例。如果您正苦于以下问题:Python Contact.get_by_user方法的具体用法?Python Contact.get_by_user怎么用?Python Contact.get_by_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Contact的用法示例。


在下文中一共展示了Contact.get_by_user方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: flash

# 需要导入模块: from models import Contact [as 别名]
# 或者: from models.Contact import get_by_user [as 别名]
    if(request.method == 'POST') and listing.user == users.get_current_user():
        listing.delete()
        flash(u'Listing deleted successfully', 'success')
        return redirect(url_for('manage_listings'))
    else:
        flash(u'You do not have permissions to perform that operation', 'error')
        return redirect(url_for('profile'))
        
@account_required
def profile():
    '''Landlord management dashboard.'''
    user = users.get_current_user()
<<<<<<< HEAD
    landlord = Landlord.get_by_user(user)
=======
    landlord = Contact.get_by_user(user)
>>>>>>> d76fc545aab7b1e1556c2efea62c18d4a20978f6
    #Generate statistics for the landlord's listings
    listings = Listing.gql('WHERE user = :1', user).count()
    available = Listing.gql('WHERE user = :1 AND occupied = False', user).count()
    occupied = listings - available
    stats = { 'listings' : listings, 'available' : available, 'occupied' : occupied }
    return render_template('dashboard.html', landlord=landlord, stats=stats)
    
@account_required
<<<<<<< HEAD
def update_landlord():
    '''Allow user to update their landlord information'''
    landlord = Landlord.get_by_user(users.get_current_user())
=======
def update_contact():
开发者ID:JonCooperWorks,项目名称:StudentHousing,代码行数:33,代码来源:views.py


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