Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Commit

Permalink
Cleanup homepage for private.
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksergeant committed Nov 30, 2016
1 parent 4c159fb commit f8f8d50
Showing 1 changed file with 1 addition and 28 deletions.
29 changes: 1 addition & 28 deletions views.py
@@ -1,12 +1,7 @@
import hashlib

from accounts.models import UserProfile
from annoying.decorators import ajax_request, render_to
from blogs.views import blog_list
from django.contrib.auth.models import User
from django.db.models import Count
from django.http import HttpResponseRedirect, HttpResponseBadRequest
from snipts.models import Snipt
from snipts.utils import get_lexers_list
from taggit.models import Tag

Expand All @@ -17,29 +12,7 @@ def homepage(request):
if request.blog_user:
return blog_list(request)

coders = []

users_with_gravatars = User.objects.filter(
userprofile__in=UserProfile.objects.filter(has_gravatar=True)
).order_by('?')

for user in users_with_gravatars:
public_snipts_count = Snipt.objects.filter(
user=user, public=True).values('pk').count()

if public_snipts_count:
user.email_md5 = hashlib.md5(user.email.lower().encode('utf-8')) \
.hexdigest()
coders.append(user)

if len(coders) == 35:
break

return {
'coders': coders,
'snipts_count': Snipt.objects.all().count(),
'users_count': User.objects.all().count(),
}
return {}


@ajax_request
Expand Down

0 comments on commit f8f8d50

Please sign in to comment.