Merge branch 'master', remote branch 'origin' into tastypie2

pull/1/head
Raymond Yee 2011-10-19 08:26:43 -07:00
commit cbb801b9d9
4 changed files with 51 additions and 50 deletions

View File

@ -10,7 +10,7 @@ class ProfileForm(forms.ModelForm):
model = UserProfile
exclude = 'user'
widgets = {
'tagline': forms.Textarea(attrs={'cols': 70, 'rows': 2}),
'tagline': forms.Textarea(attrs={'cols': 35, 'rows': 4}),
}
class UserData(forms.Form):

View File

@ -131,25 +131,16 @@ how do I integrate the your wishlist thing with the tabs thing?
<div class="block block1">
<div class="block-inner">
<h3><a class="profile-edit" href="#">Profile / edit</a></h3>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
<div class="profile-save">
<a href="#" class="profile-save">Save setting</a>
</div>
<form method="POST" action="">
{% csrf_token %}
{{ profile_form.as_p }}
<input class="profile-save" type="submit" name="submit" value="Update" id="submit">
</form>
</div>
</div>
<div class="block block2">
<h3 class="title">Pledges</h3>
<div class="check-list">
<input type="checkbox" />
<label>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</label>
</div>
<div class="check-list">
<input type="checkbox" />
<label>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</label>
</div>
</div>
<div class="block block3">
<div class="block block2">
<h3 class="title">Links</h3>
<div class="check-list">
<input type="checkbox" />
@ -160,7 +151,7 @@ how do I integrate the your wishlist thing with the tabs thing?
<label>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</label>
</div>
</div>
<div class="block block4">
<div class="block block3">
<h3 class="title">Privacy</h3>
<div class="check-list">
<input type="checkbox" />

View File

@ -17,7 +17,7 @@ from django.conf import settings
from regluit.core import models, bookloader
from regluit.core.search import gluejar_search
from regluit.frontend.forms import UserData
from regluit.frontend.forms import UserData,ProfileForm
from regluit.frontend.forms import CampaignPledgeForm
from regluit.payment.manager import PaymentManager
@ -37,33 +37,42 @@ def home(request):
return render(request, 'home.html', {'suppress_search_box': True})
def supporter(request, supporter_username):
supporter = get_object_or_404(User, username=supporter_username)
wishlist = supporter.wishlist
backed = 0
backing = 0
transet = Transaction.objects.all().filter(user = supporter)
for transaction in transet:
if(transaction.campaign.status == 'SUCCESSFUL'):
backed += 1
elif(transaction.campaign.status == 'ACTIVE'):
backing += 1
wished = supporter.wishlist.works.count()
date = supporter.date_joined.strftime("%B %d, %Y")
supporter = get_object_or_404(User, username=supporter_username)
wishlist = supporter.wishlist
backed = 0
backing = 0
transet = Transaction.objects.all().filter(user = supporter)
for transaction in transet:
if(transaction.campaign.status == 'SUCCESSFUL'):
backed += 1
elif(transaction.campaign.status == 'ACTIVE'):
backing += 1
wished = supporter.wishlist.works.count()
date = supporter.date_joined.strftime("%B %d, %Y")
# figure out what works the users have in commmon if someone
# is looking at someone elses supporter page
if not request.user.is_anonymous and request.user != supporter:
w1 = request.user.wishlist
w2 = supporter.wishlist
shared_works = models.Work.objects.filter(wishlists__in=[w1])
shared_works = list(shared_works.filter(wishlists__in=[w2]))
else:
shared_works = []
context = {
# figure out what works the users have in commmon if someone
# is looking at someone elses supporter page
if not request.user.is_anonymous and request.user != supporter:
w1 = request.user.wishlist
w2 = supporter.wishlist
shared_works = models.Work.objects.filter(wishlists__in=[w1])
shared_works = list(shared_works.filter(wishlists__in=[w2]))
else:
shared_works = []
# added following blok to support profile admin form in supporter page
if request.user.is_authenticated() and request.user.username == supporter_username:
if request.method == 'POST':
profile_form = ProfileForm(data=request.POST,instance=request.user.get_profile())
if profile_form.is_valid():
profile_form.save()
else:
profile_form = ProfileForm()
context = {
"supporter": supporter,
"wishlist": wishlist,
"backed": backed,
@ -71,9 +80,10 @@ def supporter(request, supporter_username):
"wished": wished,
"date": date,
"shared_works": shared_works,
}
return render(request, 'supporter.html', context)
"profile_form": profile_form,
}
return render(request, 'supporter.html', context)
def edit_user(request):
form=UserData()

View File

@ -523,7 +523,7 @@ div.content-block-content .cols3 .column {
}
.user-block-hide .block {
float: left;
width: 25%;
width: 33%;
}
.user-block-hide input {
float: left;
@ -609,7 +609,7 @@ a.profile-edit {
div.profile-save {
padding-top: 15px;
}
a.profile-save {
input.profile-save {
background: url("/static/images/header/save-setting.png") 0 0 no-repeat;
width: 116px;
height: 42px;