This repository has been archived by the owner on Jan 19, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cachebust my own picture, fix bug 690513
- Loading branch information
Showing
5 changed files
with
30 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,24 @@ | ||
import time | ||
|
||
import jinja2 | ||
from funfactory.urlresolvers import reverse | ||
from jingo import register | ||
|
||
|
||
@register.filter | ||
def vouched(user): | ||
if hasattr(user, 'is_vouched'): | ||
return user.is_vouched() | ||
|
||
|
||
@register.inclusion_tag('phonebook/includes/photo.html') | ||
@jinja2.contextfunction | ||
def profile_photo(context, person): | ||
user = context['request'].user | ||
me = bool(user.username == person.username) | ||
url = reverse('phonebook.profile_photo', args=[person.unique_id]) | ||
|
||
if me: | ||
url += '?%d' % int(time.time()) | ||
|
||
return dict(image_url=url) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<img class="photo u-photo"src="{{ image_url }}" id="profile-photo" | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
alt="{{ _('Profile photo') }}"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ | |
HttpResponseForbidden) | ||
from django.shortcuts import redirect, render | ||
from django.views.decorators.cache import never_cache | ||
from django.views.decorators.csrf import csrf_exempt | ||
from django.views.decorators.http import require_POST | ||
|
||
import jingo | ||
|
@@ -99,11 +98,9 @@ def _profile(request, person, use_master): | |
person.irc_nickname = services[MOZILLA_IRC_SERVICE_URI] | ||
del services[MOZILLA_IRC_SERVICE_URI] | ||
|
||
return jingo.render(request, 'phonebook/profile.html', | ||
dict(absolutify=absolutify, | ||
person=person, | ||
vouch_form=vouch_form, | ||
services=services)) | ||
data = dict(absolutify=absolutify, person=person, vouch_form=vouch_form, | ||
This comment has been minimized.
Sorry, something went wrong.
cvan
|
||
services=services) | ||
return jingo.render(request, 'phonebook/profile.html', data) | ||
|
||
|
||
@never_cache | ||
|
should probably be a space before
src