invitation based changes 0.9
This commit is contained in:
parent
c73cd51552
commit
5e247ba3ff
|
@ -39,8 +39,6 @@ class PopupForm(ItfForm):
|
|||
'''
|
||||
pass
|
||||
|
||||
|
||||
|
||||
class AutocompleteAddWidget(forms.Select):
|
||||
'''
|
||||
Widget for select2 single select
|
||||
|
|
|
@ -44,7 +44,7 @@ def popup_form(request, ctype_id):
|
|||
if request.POST:
|
||||
form = form_class(request.POST, request.FILES)
|
||||
if form.is_valid():
|
||||
instance = form.save(commit=False)
|
||||
instance = form.save(commit=False, request=request)
|
||||
if instance.__dict__.has_key('added_by_id'):
|
||||
instance.added_by = request.user
|
||||
instance.save()
|
||||
|
|
|
@ -74,6 +74,29 @@ PadmaClipsInline = itf_inlineformset_factory(PadmaClip, extra=1, is_generic=True
|
|||
#Popup Form Classes:
|
||||
class PopupPersonForm(PopupForm):
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
if kwargs.has_key('request'):
|
||||
request = kwargs.pop('request')
|
||||
#form = PersonForm(request.POST, request.FILES)
|
||||
|
||||
invitee = super(PopupPersonForm, self).save(*args, **kwargs)
|
||||
invitee.save()
|
||||
invitation = PersonInvitation(
|
||||
invitee=invitee,
|
||||
invite_code=User.objects.make_random_password(30),
|
||||
is_validated=False,
|
||||
inviter=Person.objects.get(user=request.user),
|
||||
sent_date=datetime.now()
|
||||
)
|
||||
|
||||
invitation.save()
|
||||
#import pdb
|
||||
#pdb.set_trace()
|
||||
invitation.send_invite()
|
||||
|
||||
return invitee
|
||||
|
||||
|
||||
class Meta:
|
||||
model = Person
|
||||
fields = ('first_name', 'last_name', 'email',)
|
||||
|
@ -221,6 +244,7 @@ class ProductionForm(ItfForm):
|
|||
class ItfAllAuthRegForm(forms.Form):
|
||||
firstname=forms.CharField()
|
||||
lastname=forms.CharField()
|
||||
#invite_code=forms.HiddenField()
|
||||
|
||||
#def __init__(self, request=None):
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
|
||||
from django.db import models
|
||||
from app.models import ItfModel
|
||||
from django.contrib.auth.models import User
|
||||
|
@ -142,19 +143,25 @@ class PersonInvitation(models.Model):
|
|||
is_validated=models.BooleanField(default=False)
|
||||
sent_date = models.DateTimeField()
|
||||
|
||||
def send_mail(self):
|
||||
def send_invite(self):
|
||||
#import pdb ; pdb.set_trace()
|
||||
#from django.template.loader import get_template
|
||||
from django.core.mail import send_mail
|
||||
from django.template.loader import get_template
|
||||
from django.template import Context
|
||||
from itf.settings import SITE_HOST, DEFAULT_FROM_MAIL
|
||||
|
||||
template = get_template('modules/itfprofiles/invitation_email.txt')
|
||||
subject = 'Invitation to join the India Theatre Forum'
|
||||
link = 'http://%s/invitation/accept/%s/' % ( "test.theatreforum.in", self.invite_code, )
|
||||
|
||||
|
||||
link = 'http://%s/invitation/accept/%s/' % ( SITE_HOST, self.invite_code, )
|
||||
|
||||
context = Context({
|
||||
'name': str(self.invitee.first_name) + str(self.invitee.last_name),
|
||||
'name': str(self.invitee.first_name) + ' ' + str(self.invitee.last_name),
|
||||
'link': link,
|
||||
'sender': str(self.inviter.first_name) + str(self.inviter.last_name)
|
||||
'sender': str(self.inviter.first_name) + ' ' + str(self.inviter.last_name)
|
||||
})
|
||||
message = template.render(context)
|
||||
message = template.render(context)
|
||||
send_mail(
|
||||
subject, message,
|
||||
DEFAULT_FROM_MAIL, [self.invitee.email]
|
||||
|
|
|
@ -55,7 +55,7 @@ def friend_invite(request):
|
|||
if request.method == 'POST':
|
||||
form = PersonForm(request.POST, request.FILES)
|
||||
if form.is_valid():
|
||||
invitee = form.save()
|
||||
invitee = form.save()
|
||||
invitation = PersonInvitation(
|
||||
invitee=invitee,
|
||||
invite_code=User.objects.make_random_password(30),
|
||||
|
@ -65,7 +65,7 @@ def friend_invite(request):
|
|||
)
|
||||
invitation.save()
|
||||
#try:
|
||||
invitation.send_mail()
|
||||
invitation.send_invite()
|
||||
#except:
|
||||
# return HttpResponse("<html><body>Not Invited!!</body></html>")
|
||||
return HttpResponse("<html><body>Invited!!</body></html>")
|
||||
|
@ -97,15 +97,6 @@ def personpopup(request):
|
|||
form = PersonForm(request.POST, request.FILES)
|
||||
if form.is_valid():
|
||||
instance = form.save()
|
||||
invitation = PersonInvitation(
|
||||
invitee=invitee,
|
||||
invite_code=User.objects.make_random_password(30),
|
||||
is_validated=False,
|
||||
inviter=Person.objects.get(user=request.user),
|
||||
sent_date=datetime.now()
|
||||
)
|
||||
invitation.save()
|
||||
invitation.send_mail()
|
||||
#return HttpResponse("<html><body>This person will be Invited!</body></html>")
|
||||
#return HttpResponse("<script>opener.dismissAddAnotherPopup(this, '%s', '%s')</script>" % (str(instance.id), instance.get_title()))
|
||||
else:
|
||||
|
|
|
@ -10,7 +10,10 @@ Who we are.. Our roots.. And The vision..
|
|||
Since the summer of 2006, a number of theatre practitioners, scholars and theatre lovers have come together under the aegis of the India Theatre Forum (ITF) to try and create a national resource for theatre and a meeting ground for all those who wish to take on the public responsibility of laying the grounds for excellence and diversity in theatrical endeavour.
|
||||
|
||||
The question that led to the creation of the ITF was: can this happenstance become the norm?
|
||||
Can we overcome what we see as limitations, can we learn to identify and recognize opportunities and openings, can we think in terms of long-term growth and sustenance? Such work cannot be done in isolation, but requires the coming together of dedicated and experienced people who have an abiding interest in the field of theatre, and who represent the diverse knowledge and experience base of theatre in this country. It requires the constant exchange of ideas and information, as well as intensive and open debate and discussion.
|
||||
Can we overcome what we see as limitations, can we learn to identify and recognize opportunities and openings, can we think in terms of long-term growth and sustenance?
|
||||
Such work cannot be done in isolation, but requires the coming together of dedicated and experienced people who have an abiding interest in the field of theatre, and who represent the diverse knowledge and experience base of theatre in this country. It requires the constant exchange of ideas and information, as well as intensive and open debate and discussion.
|
||||
|
||||
It is in this new era that the performing arts must evolve collaboratively and co-operatively like never before.
|
||||
|
||||
--
|
||||
India Theatre Forum
|
||||
|
|
Loading…
Reference in New Issue
Block a user