def dashboard(): return render_template( 'administrators/views/dashboard.html', categories=utilities.get_integer(g.mysql.query(models.category).count()), handles=utilities.get_integer(g.mysql.query(models.handle).count()), tweets=utilities.get_integer(g.mysql.query(models.tweet).count()), )
def dashboard(): return render_template( 'administrators/views/dashboard.html', customers=utilities.get_integer( g.mysql.query(models.customer).filter( models.customer.ID.in_(models.get_customer_ids())).count()), orders=utilities.get_integer(g.mysql.query(models.order).count()), )
def searches_export(): profiles, _ = get_profiles_and_pager( loads(request.args.get('filter')), loads(request.args.get('order_by')), int(request.args.get('limit', '25')), int(request.args.get('page', '1')), ) csv = StringIO() writer( csv, delimiter=',', doublequote=True, lineterminator='\n', quotechar='"', quoting=QUOTE_ALL, skipinitialspace=True, ).writerows([[ 'Age Group', 'Date', 'Description', 'Facebook ID', 'Image', 'Likes', 'Local URL', 'Location', 'Name', 'Primary Category', 'Remote URL', 'Secondary Category', 'Talking About (%)', 'Talking About', ]] + [[ profile.others_age_group.encode('utf-8') if profile.others_age_group else '', profile.date.encode('utf-8') if profile.date else '', profile.description.encode('utf-8') if profile.description else '', profile.facebook_id if profile.facebook_id else '', profile.image.encode('utf-8'), utilities.get_integer(profile.numbers_likes), profile.urls_local.encode('utf-8'), profile.location.encode('utf-8') if profile.location else '', profile.name.encode('utf-8'), profile.categories_primary.encode('utf-8') if profile.categories_primary else '', profile.urls_remote.encode('utf-8') if profile.urls_remote else '', profile.categories_secondary.encode('utf-8') if profile.categories_secondary else '', utilities.get_float(profile.numbers_discussions_relative), utilities.get_integer(profile.numbers_discussions_absolute), ] for profile in profiles]) return Response( csv.getvalue(), headers={ 'Content-Disposition': 'attachment; filename=export.csv', }, mimetype='text/csv' )
def searches_export(): profiles, _ = get_profiles_and_pager( loads(request.args.get('filter')), loads(request.args.get('order_by')), int(request.args.get('limit', '25')), int(request.args.get('page', '1')), ) csv = StringIO() writer( csv, delimiter=',', doublequote=True, lineterminator='\n', quotechar='"', quoting=QUOTE_ALL, skipinitialspace=True, ).writerows([[ 'Age Group', 'Date', 'Description', 'Facebook ID', 'Image', 'Likes', 'Local URL', 'Location', 'Name', 'Primary Category', 'Remote URL', 'Secondary Category', 'Talking About (%)', 'Talking About', ]] + [[ profile.others_age_group.encode('utf-8') if profile. others_age_group else '', profile.date.encode('utf-8') if profile.date else '', profile.description.encode('utf-8') if profile.description else '', profile.facebook_id if profile.facebook_id else '', profile.image.encode('utf-8'), utilities.get_integer(profile.numbers_likes), profile.urls_local.encode('utf-8'), profile.location.encode('utf-8') if profile.location else '', profile.name.encode('utf-8'), profile.categories_primary.encode('utf-8') if profile. categories_primary else '', profile.urls_remote.encode('utf-8') if profile.urls_remote else '', profile.categories_secondary.encode('utf-8') if profile. categories_secondary else '', utilities.get_float(profile.numbers_discussions_relative), utilities.get_integer(profile.numbers_discussions_absolute), ] for profile in profiles]) return Response(csv.getvalue(), headers={ 'Content-Disposition': 'attachment; filename=export.csv', }, mimetype='text/csv')
def format_integer(value): return utilities.get_integer(value)