Example #1
0
def proposal_add(request):

    try:
        speaker = Speaker.objects.get(user=request.user)
    except Speaker.DoesNotExist:
        if request.user.first_name or request.user.last_name:
            name = u'{0} {1}'.format(request.user.first_name, request.user.last_name)
        else:
            name = request.user.username
        speaker = Speaker(user=request.user,
            name = name,
            invite_email = request.user.email,
            invite_token = '')

    if request.method == 'POST':
        form = ProposalForm(request.POST)

        if form.is_valid():

            #save speaker
            speaker.biography = form.cleaned_data['biography']
            speaker.annotation = speaker.annotation or ''
            speaker.save()

            #save proposal
            Proposal.objects.create(
                title=form.cleaned_data['title'],
                description=form.cleaned_data['description'],
                kind=form.cleaned_data['kind'],
                category=PresentationCategory.objects.get(slug='general'),
                abstract=form.cleaned_data['abstract'],
                audience_level=form.cleaned_data['audience_level'],
                additional_notes=form.cleaned_data['additional_notes'],
                duration=form.cleaned_data['duration'],
                speaker=speaker,
                submitted=datetime.datetime.now(),
                cancelled=False)

            return HttpResponseRedirect('/proposal-sent')
    else:
        form = ProposalForm(initial={'biography': speaker.biography.raw})

    return render_to_response('proposal_add.html', {
        'form': form,
        }, context_instance=RequestContext(request))
Example #2
0
# -*- coding: utf-8 -*-
# monkey_patching Speaker add organisation field

from django.db import models
from symposion.speakers.models import Speaker

Speaker.add_to_class("organisation", models.CharField(max_length=100, blank=True))
Speaker.add_to_class("city", models.CharField(max_length=255, blank=True))
Speaker.add_to_class("need_travel", models.BooleanField(default=False))
Speaker.add_to_class("need_hosting", models.BooleanField(default=False))
# -*- coding: utf-8 -*-
# monkey_patching Speaker add organisation field

from django.db import models
from symposion.speakers.models import Speaker

Speaker.add_to_class('organisation', models.CharField(max_length=100,blank=True))