Ejemplo n.º 1
0
def prepare_card(owner, student_id, season_name, course_code, info_line_1, info_line_2):
    student = Student.get_by_id(int(student_id))
    if student is None:
        return
    
    card = Card() 
    card.init(owner=owner,name=student.name, surname=student.surname, season_name=season_name,  course_code=course_code, info_line_1=info_line_1, info_line_2=info_line_2)
    card.save()
    logging.info('card=%s'%card)
Ejemplo n.º 2
0
def create(request):

    card = Card()
    card.init(owner=request.auth_info.email)
    if request.method == 'POST':
        form = CardForm(request.POST, instance=card)
        if form.is_valid():
            logging.info('edit card before %s'% card)
            form.save(commit=False)
            logging.info('edit card after %s'% card)
            card.save()
            return HttpResponseRedirect('..')
    else:
        form = CardForm(instance=card)

    return render_to_response('admin/cards_create.html', RequestContext(request, {'form':form}))