Exemple #1
0
def edit_delegate(request, school, conference):
    if request.method == 'POST':
        position_pk = request.POST.get('position_pk', '')
        delegate_position = DelegatePosition.objects.get(pk=position_pk)
        if delegate_position.school == school:
            try:
                delegate = Delegate.objects.get(
                    position_assignment=delegate_position)
            except Delegate.DoesNotExist:
                delegate = Delegate()
                delegate.position_assignment = delegate_position
            form = DelegateNameForm(data=request.POST, instance=delegate)
            if form.is_valid():
                delegate = form.save(commit=False)
                delegate.save()
                return simplejson.dumps({
                    'name':
                    delegate.first_name + " " + delegate.last_name,
                    'position_pk':
                    position_pk
                })
            else:
                return simplejson.dumps({
                    'form': form.as_p(),
                    'position_pk': position_pk
                })
Exemple #2
0
def get_edit_delegate_form(request, school, conference):
    if request.method == 'POST':
        position_pk = request.POST.get('position_pk','')
        delegate_position = DelegatePosition.objects.get(pk=position_pk)
        if delegate_position.school == school:
            try:
                delegate = Delegate.objects.get(position_assignment=delegate_position)
                form = DelegateNameForm(instance=delegate)
            except Delegate.DoesNotExist:
                form = DelegateNameForm()
            return simplejson.dumps({'form':form.as_p(), 'position_pk':position_pk})
Exemple #3
0
def get_edit_delegate_form(request, school, conference):
    if request.method == 'POST':
        position_pk = request.POST.get('position_pk', '')
        delegate_position = DelegatePosition.objects.get(pk=position_pk)
        if delegate_position.school == school:
            try:
                delegate = Delegate.objects.get(
                    position_assignment=delegate_position)
                form = DelegateNameForm(instance=delegate)
            except Delegate.DoesNotExist:
                form = DelegateNameForm()
            return simplejson.dumps({
                'form': form.as_p(),
                'position_pk': position_pk
            })
Exemple #4
0
def edit_delegate(request, school, conference):
    if request.method == 'POST':
        position_pk = request.POST.get('position_pk','')
        delegate_position = DelegatePosition.objects.get(pk=position_pk)
        if delegate_position.school == school:
            try:
                delegate = Delegate.objects.get(position_assignment=delegate_position)
            except Delegate.DoesNotExist:
                delegate = Delegate()
                delegate.position_assignment = delegate_position
            form = DelegateNameForm(data=request.POST, instance=delegate)
            if form.is_valid():
                delegate = form.save(commit=False)
                delegate.save()
                return simplejson.dumps({'name':delegate.first_name + " " + delegate.last_name, 'position_pk':position_pk})
            else:
                return simplejson.dumps({'form':form.as_p(), 'position_pk':position_pk})