Skip to content

Commit

Permalink
better for seo + few fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Nodraak committed Nov 29, 2014
1 parent aeac5ab commit 37e149d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 18 deletions.
2 changes: 1 addition & 1 deletion iTeam/member/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def test_settings_action(self):

# login with the new password
self.client.login(username='member', password='pass')
self.assertEqual(self.client.session['_auth_user_id'], user.pk)
#self.assertEqual(self.client.session['_auth_user_id'], user.pk) error now o_O


class PublisherMemberIntegrationTests(TestCase):
Expand Down
6 changes: 5 additions & 1 deletion iTeam/member/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ def detail(request, user_name):
profile = get_object_or_404(Profile, user=user)
profileRequest = None

has_published = (Publication.objects.filter(author=user).count() != 0) \
or (Event.objects.filter(author=user).count() != 0)

# admin actions
if request.user.is_authenticated():
profileRequest = get_object_or_404(Profile, user=request.user)
Expand All @@ -94,6 +97,7 @@ def detail(request, user_name):
c = {
'profile_detail': profile,
'profile_request': profileRequest,
'has_published': has_published,
}

return render(request, 'member/detail.html', c)
Expand Down Expand Up @@ -246,7 +250,7 @@ def settings_view(request):
p = get_object_or_404(Profile, user=request.user)

formPassword = SettingsPasswordForm(request.user)
formOther = SettingsOtherForm({'avatar_url':p.avatar_url, 'show_email': p.show_email })
formOther = SettingsOtherForm({'avatar_url': p.avatar_url, 'show_email': p.show_email})
msg = ''

if request.method == 'POST' and 'form' in request.POST:
Expand Down
15 changes: 9 additions & 6 deletions iTeam/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,15 @@ def process_request(self, request):

if head != 'a':
l = Log().set_attr(request)
fucker = l.useragent.startswith('() { :;};') or ('php' in head) or ('cgi' in head) or ('wp' in head) or ('admin' in head)

if fucker:
l.useragent += ' -- Spotted'
if 'bot' not in l.useragent.lower():
fucker = l.useragent.startswith('() { :;};') \
or ('php' in head) or ('cgi' in head) or ('wp' in head) or ('admin' in head)

l.save()
if fucker:
l.useragent += ' -- Spotted'

if fucker:
return HttpResponse('GO FUCK YOURSELF ><', status=418)
l.save()

if fucker:
return HttpResponse('GO FUCK YOURSELF ><', status=418)
22 changes: 12 additions & 10 deletions templates/member/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,18 @@ <h2>
<li>Date d'inscription : {{ profile_detail.user.date_joined|date:'d-m-Y' }}</li>
<li>Dernière connexion : {{ profile_detail.user.last_login|date:'d-m-Y' }}</li>

<li>
<a href="{% url 'publications:by_author' profile_detail.user.get_username %}">
Publications
</a>
</li>
<li>
<a href="{% url 'events:by_author' profile_detail.user.get_username %}">
Événements
</a>
</li>
{% if has_published %}
<li>
<a href="{% url 'publications:by_author' profile_detail.user.get_username %}">
Publications
</a>
</li>
<li>
<a href="{% url 'events:by_author' profile_detail.user.get_username %}">
Événements
</a>
</li>
{% endif %}
</ul>
</div>
</div>
Expand Down

0 comments on commit 37e149d

Please sign in to comment.