Exemple #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))
Exemple #2
0
 def setUp(self):
     # Create base conference infrastructure that has to exist in
     # order to create a Proposal.
     conference = Conference(title="Conference")
     conference.save()
     section = Section(conference=conference,
                       name="Section",
                       slug="section")
     section.save()
     proposal_kind = ProposalKind(section=section, name="Kind", slug="kind")
     proposal_kind.save()
     speaker = Speaker(name="Paul Ryan")
     speaker.save()
     self.proposal = Proposal.objects.create(
         title="Title",
         description="Description",
         abstract="Abstract",
         kind=proposal_kind,
         speaker=speaker,
         audience_level=1,
     )
Exemple #3
0
def get_accepted_speaker_by_slug(speaker_slug):
    """
    This function is purposely done do avoid touching Symposion
    source code. Given the amount of approved speakers is not
    substantial, it's better to iterate over speakers, slugify name,
    and check equality, than create a new field in Symposion.
    """
    approved_talks = Proposal.objects.filter(
        result__status='accepted').prefetch_related('speaker')
    for approved_talk in approved_talks:
        if approved_talk.speaker.name_slug == speaker_slug:
            return approved_talk.speaker

    raise Speaker.DoesNotExist()
Exemple #4
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))