de-association from twitter and facebook are now supported
parent
6b38e7d9b4
commit
4c65a11696
|
@ -6,9 +6,11 @@ from django.utils.translation import ugettext_lazy as _
|
|||
from decimal import Decimal as D
|
||||
|
||||
class ProfileForm(forms.ModelForm):
|
||||
clear_facebook=forms.BooleanField(required=False)
|
||||
clear_twitter=forms.BooleanField(required=False)
|
||||
class Meta:
|
||||
model = UserProfile
|
||||
fields = 'tagline', 'librarything_id', 'home_url'
|
||||
fields = 'tagline', 'librarything_id', 'home_url', 'clear_facebook', 'clear_twitter'
|
||||
widgets = {
|
||||
'tagline': forms.Textarea(attrs={'cols': 35, 'rows': 4}),
|
||||
}
|
||||
|
|
|
@ -125,14 +125,14 @@ how do I integrate the your wishlist thing with the tabs thing?
|
|||
</div>
|
||||
<div class="check-list">
|
||||
{% if supporter.profile.twitter_id %}
|
||||
<a href="{% url socialauth_associate_begin backend='twitter' %}">Update your Twitter connection</a>
|
||||
<a href="{% url socialauth_associate_begin backend='twitter' %}">Update your Twitter connection</a> <br/> or disconnect Twitter: {{ profile_form.clear_twitter }}
|
||||
{% else %}
|
||||
<a href="{% url socialauth_associate_begin backend='twitter' %}">Connect your Twitter account</a> to Unglue.it
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="check-list">
|
||||
{% if supporter.profile.facebook_id %}
|
||||
<a href="{% url socialauth_associate_begin backend='facebook' %}">Update your Facebook connection</a>
|
||||
<a href="{% url socialauth_associate_begin backend='facebook' %}">Update your Facebook connection</a> <br/> or disconnect Facebook: {{ profile_form.clear_facebook }}
|
||||
{% else %}
|
||||
<a href="{% url socialauth_associate_begin backend='facebook' %}">Connect your Facebook account</a> to Unglue.it
|
||||
{% endif %}
|
||||
|
|
|
@ -115,6 +115,12 @@ def supporter(request, supporter_username, template_name):
|
|||
if request.method == 'POST':
|
||||
profile_form = ProfileForm(data=request.POST,instance=profile_obj)
|
||||
if profile_form.is_valid():
|
||||
if profile_form.cleaned_data['clear_facebook'] or profile_form.cleaned_data['clear_twitter'] :
|
||||
if profile_form.cleaned_data['clear_facebook']:
|
||||
profile_obj.facebook_id=0
|
||||
if profile_form.cleaned_data['clear_twitter']:
|
||||
profile_obj.twitter_id=""
|
||||
profile_obj.save()
|
||||
profile_form.save()
|
||||
else:
|
||||
profile_form= ProfileForm(instance=profile_obj)
|
||||
|
|
Loading…
Reference in New Issue