def create_meeting(request): form_class = Meeting.CreateForm if request.method == "POST": # Get post data from form form = form_class(request.POST) if form.is_valid(): data = form.cleaned_data meeting = Meeting() meeting.name = data.get('name') #password = hashlib.sha1(data.get('password')).hexdigest() meeting.attendee_password = data.get('attendee_password') meeting.moderator_password = data.get('moderator_password') meeting.meeting_id = data.get('meeting_id') try: url = meeting.start() meeting.save() msg = 'Successfully created meeting %s' % meeting.meeting_id messages.success(request, msg) return HttpResponseRedirect(reverse('meetings')) except: return HttpResponse("An error occureed whilst creating the " \ "meeting. The meeting has probably been " "deleted recently but is still running.") else: form = form_class() context = RequestContext(request, { 'form': form, }) return render_to_response('create.html', context)
def create_meeting(request): form_class = CreateForm if request.method == "POST": # Get post data from form form = form_class(request.POST) if form.is_valid(): data = form.cleaned_data meeting = Meeting() meeting.name = data.get('name') meeting.attendee_password = data.get('attendee_password') meeting.moderator_password = data.get('moderator_password') meeting.timestart = data.get('timestart') meeting.duration = data.get('duration') meeting.record = data.get('record') meeting.public = data.get('public') meeting.openout = data.get('openout') meeting.owner = request.user meeting.save() return HttpResponseRedirect(reverse('meetings')) else: form = form_class() context = RequestContext(request, { 'form': form, }) return render_to_response('create.html', context)