Example #1
0
def index(request):
    if request.method == "POST":
        if request.POST['submit'] == 'login':
            login_form = LoginForm(request.POST, prefix='login')
            signup_form = SignupForm(prefix='signup')
        else:
            login_form = LoginForm(prefix='login')
            signup_form = SignupForm(request.POST, prefix='signup')
    else:
        login_form = LoginForm(prefix='login')
        signup_form = SignupForm(prefix='signup')

    user = get_user(request)
    authed = request.user.is_authenticated()
    features = Feature.objects.all()[:3]
    feature_form = FeatureForm() if request.user.is_staff else None
    feed_count = UserSubscription.objects.filter(
        user=request.user).count() if authed else 0
    active_count = UserSubscription.objects.filter(
        user=request.user, active=True).count() if authed else 0
    train_count = UserSubscription.objects.filter(
        user=request.user,
        active=True,
        is_trained=False,
        feed__stories_last_month__gte=1).count() if authed else 0
    recommended_feeds = RecommendedFeed.objects.filter(
        is_public=True,
        approved_date__lte=datetime.datetime.now()).select_related('feed')[:2]
    unmoderated_feeds = RecommendedFeed.objects.filter(
        is_public=False, declined_date__isnull=True).select_related('feed')[:2]
    statistics = MStatistics.all()
    feedbacks = MFeedback.all()
    start_import_from_google_reader = request.session.get(
        'import_from_google_reader', False)
    if start_import_from_google_reader:
        del request.session['import_from_google_reader']

    return render_to_response(
        'reader/feeds.xhtml', {
            'user_profile': hasattr(user, 'profile') and user.profile,
            'login_form': login_form,
            'signup_form': signup_form,
            'feature_form': feature_form,
            'features': features,
            'feed_count': feed_count,
            'active_count': active_count,
            'train_count': active_count - train_count,
            'account_images': range(1, 4),
            'recommended_feeds': recommended_feeds,
            'unmoderated_feeds': unmoderated_feeds,
            'statistics': statistics,
            'feedbacks': feedbacks,
            'start_import_from_google_reader': start_import_from_google_reader,
        },
        context_instance=RequestContext(request))
Example #2
0
def index(request):
    if request.method == "POST":
        if request.POST['submit'] == 'login':
            login_form  = LoginForm(request.POST, prefix='login')
            signup_form = SignupForm(prefix='signup')
        else:
            login_form  = LoginForm(prefix='login')
            signup_form = SignupForm(request.POST, prefix='signup')
    else:
        login_form  = LoginForm(prefix='login')
        signup_form = SignupForm(prefix='signup')
    
    user         = get_user(request)
    authed       = request.user.is_authenticated()
    features     = Feature.objects.all()[:3]
    feature_form = FeatureForm() if request.user.is_staff else None
    feed_count   = UserSubscription.objects.filter(user=request.user).count() if authed else 0
    active_count = UserSubscription.objects.filter(user=request.user, active=True).count() if authed else 0
    train_count  = UserSubscription.objects.filter(user=request.user, active=True, is_trained=False, feed__stories_last_month__gte=1).count() if authed else 0
    recommended_feeds = RecommendedFeed.objects.filter(is_public=True, approved_date__lte=datetime.datetime.now()).select_related('feed')[:2]
    unmoderated_feeds = RecommendedFeed.objects.filter(is_public=False, declined_date__isnull=True).select_related('feed')[:2]
    statistics   = MStatistics.all()
    feedbacks    = MFeedback.all()
    start_import_from_google_reader = request.session.get('import_from_google_reader', False)
    if start_import_from_google_reader:
        del request.session['import_from_google_reader']

    return render_to_response('reader/feeds.xhtml', {
        'user_profile'      : hasattr(user, 'profile') and user.profile,
        'login_form'        : login_form,
        'signup_form'       : signup_form,
        'feature_form'      : feature_form,
        'features'          : features,
        'feed_count'        : feed_count,
        'active_count'      : active_count,
        'train_count'       : active_count - train_count,
        'account_images'    : range(1, 4),
        'recommended_feeds' : recommended_feeds,
        'unmoderated_feeds' : unmoderated_feeds,
        'statistics'        : statistics,
        'feedbacks'         : feedbacks,
        'start_import_from_google_reader': start_import_from_google_reader,
    }, context_instance=RequestContext(request))
Example #3
0
 def handle(self, *args, **options):
     MFeedback.collect_feedback()
Example #4
0
def feedback_table(request):
    feedbacks = MFeedback.all()
    return render_to_response(
        "statistics/render_feedback_table.xhtml", {"feedbacks": feedbacks}, context_instance=RequestContext(request)
    )
Example #5
0
def render_feedback_table():
    feedbacks = MFeedback.all()
    return dict(feedbacks=feedbacks)
Example #6
0
def feedback_table(request):
    feedbacks = MFeedback.all()
    return render(request, 'statistics/render_feedback_table.xhtml',
                  {'feedbacks': feedbacks})
Example #7
0
 def run(self, **kwargs):
     logging.debug(" ---> Collecting feedback...")
     MFeedback.collect_feedback()
     
Example #8
0
def feedback_table(request):
    feedbacks = MFeedback.all()
    return render_to_response('statistics/render_feedback_table.xhtml', {
        'feedbacks': feedbacks,
    }, context_instance=RequestContext(request))
Example #9
0
 def run(self, **kwargs):
     # logging.debug(" ---> ~FBCollecting feedback...")
     MFeedback.collect_feedback()
Example #10
0
 def handle(self, *args, **options):
     MFeedback.collect_feedback()
Example #11
0
def feedback_table(request):
    feedbacks = MFeedback.all()
    return render_to_response('statistics/render_feedback_table.xhtml', {
        'feedbacks': feedbacks,
    },
                              context_instance=RequestContext(request))
def render_feedback_table():
    feedbacks = MFeedback.all()
    return dict(feedbacks=feedbacks)
Example #13
0
def CollectFeedback():
    logging.debug(" ---> ~FBCollecting feedback...")
    MFeedback.collect_feedback()