Example #1
0
def update_profile(request):
    if request.method == 'POST':
        member_form = MemberForm(request.POST)
        if not is_member(request.user):
            if member_form.is_valid(
            ) and member_form.cleaned_data['becomeMember']:
                group_name = models.SchoolYear.objects.current(
                ).get_member_group()
                g = Group.objects.get(name=group_name)
                g.user_set.add(request.user)
        user_form = UserForm(request.POST, instance=request.user)
        profile_form = ProfileForm(request.POST, instance=request.user.profile)
        if user_form.is_valid() and profile_form.is_valid():
            user_form.save()
            profile_form.save()
            messages.success(request, 'Your profile was successfully updated!')
            return redirect('/profile')
        else:
            messages.error(request, 'Please correct the error below.')
    else:
        member_form = MemberForm()
        user_form = UserForm(instance=request.user)
        profile_form = ProfileForm(instance=request.user.profile)
    return render(
        request, 'profile.html', {
            'member_form': member_form,
            'user_form': user_form,
            'profile_form': profile_form,
            'school_year': models.SchoolYear.objects.current()
        })
Example #2
0
def register(request):
    # A HTTP POST?
    if request.method == 'POST':
        form = MemberForm(request.POST)

        # Have we been provided with a valid form?
        if form.is_valid():
            human = True
            # Save the new category to the database.
            new_member = form.save(commit=True)

            # Now call the index() view.
            # The user will be shown the homepage.
            return show_msg(request, str(new_member.id))
        else:
            # The supplied form contained errors - just print them to the terminal.
            print form.errors
    else:
        # If the request was not a POST, display the form to enter details.
        form = MemberForm()

    return render(request, 'register.html', {
        'page_title': 'Register',
        'form': form,
    })
Example #3
0
def bemember(request):
    if request.POST:
        form = MemberForm(request.POST or None)
        if form.is_valid():
            form.save(commit=True)
            context = {
                "check": False,
            }
            return render(request, "eyv.html", context)
        else:
            print request.POST.get
            name = request.POST['name']
            name0 = request.POST['name0']
            name1 = request.POST['name1']
            name2 = request.POST['name2']
            name3 = request.POST['name3']
            name4 = request.POST['name4']
            context = {
                "form": form,
                "check": True,
                "name": name,
                "name0": name0,
                "name1": name1,
                "name2": name2,
                "name3": name3,
                "name4": name4,
            }
            return render(request, "base2.html", context)
    else:
        context = {
            "check": False,
        }
        return render(request, "base2.html", context)
Example #4
0
def index(request):
    if request.method == 'POST':
        params = request.POST
        
        if "action" in params and params["action"] is not None and params["action"] != '':
            index = 0
            for member in members:
                if member['id'] == params["action"]:
                    del members[index]
                    break
                index = index + 1
            
            return render_to_response('index.html', {'form': MemberForm(), 'members': members}, context_instance=RequestContext(request))
        else:
            member_form = MemberForm(request.POST) 
            
            if member_form.is_valid():
                mem_id = len(members)
                name = member_form.cleaned_data['last_name'] + ", " + member_form.cleaned_data['first_name']
                members.append({'id': mem_id,
                                'name': name,
                                'email': member_form.cleaned_data['email'],
                                'status': member_form.cleaned_data['status']  
                                })
            return render_to_response('index.html', {'form': member_form, 'members': members}, context_instance=RequestContext(request))
    else:    
        return render_to_response('index.html', {'form': MemberForm(), 'members': members}, context_instance=RequestContext(request))
Example #5
0
 def update(self, project, member_id):
     form = MemberForm(project, csrf_enabled=False)
     if form.validate():
         member = Person.query.get(member_id, project)
         form.save(project, member)
         db.session.commit()
         return 200, member
     return 400, form.errors
Example #6
0
 def add(self, project):
     form = MemberForm(project, csrf_enabled=False)
     if form.validate():
         member = Person()
         form.save(project, member)
         db.session.commit()
         return 201, member.id
     return 400, form.errors
Example #7
0
 def add(self, project):
     form = MemberForm(project, csrf_enabled=False)
     if form.validate():
         member = Person()
         form.save(project, member)
         db.session.commit()
         return 201, member.id
     return 400, form.errors
Example #8
0
 def update(self, project, member_id):
     form = MemberForm(project, csrf_enabled=False)
     if form.validate():
         member = Person.query.get(member_id, project)
         form.save(project, member)
         db.session.commit()
         return 200, member
     return 400, form.errors
Example #9
0
def add_member():
    form = MemberForm()
    if form.validate_on_submit():
        new_user = User(firstname=form.firstname.data,
                        lastname=form.lastname.data,
                        email=form.email.data,
                        bmID=current_user.bmID)
        db.session.add(new_user)
        db.session.commit()
        return redirect(url_for("view_members"))
    return render_template("add-member.html", form=form)
Example #10
0
def add_member():
    # FIXME manage form errors on the list_bills page
    form = MemberForm(g.project)
    if request.method == "POST":
        if form.validate():
            member = form.save(g.project, Person())
            db.session.commit()
            flash(_("%(member)s had been added", member=member.name))
            return redirect(url_for(".list_bills"))

    return render_template("add_member.html", form=form)
Example #11
0
def add_member():
    # FIXME manage form errors on the list_bills page
    form = MemberForm(g.project)
    if request.method == "POST":
        if form.validate():
            member = form.save(g.project, Person())
            db.session.commit()
            flash(_("%(member)s had been added", member=member.name))
            return redirect(url_for(".list_bills"))

    return render_template("add_member.html", form=form)
def members():
    """Show full list of club members and add new club members to list and database"""
    form = MemberForm()
    members = db.query(Member).order_by(Member.member_id)

    if form.validate_on_submit():
        db.add(Member(name=form.name.data, id_type=form.id_type.data, id_number=form.id_number.data))
        db.commit()
        flash("Membro adicionado com sucesso", "success")
        return redirect(url_for("members"))
    
    return render_template("membros.html", form=form, members=members)
Example #13
0
def register():
    member_form = MemberForm(request.form)
    if request.method == 'POST' and member_form.validate():
        username = member_form.username.data
        password = member_form.password.data
        name = member_form.name.data
        surname = member_form.surname.data
        e_mail = member_form.e_mail.data
        country = member_form.country.data
        user = User(username, password, name, surname, e_mail, country)
        user.save()
        flash('You were succesfully registered. Please login.', 'success')
        return redirect('/login')

    return render_template('register.html', form=member_form)
Example #14
0
def edit_member(user_id):
    user = User.query.get(user_id)
    edit_form = MemberForm(firstname=user.firstname,
                           lastname=user.lastname,
                           email=user.email)
    if edit_form.validate_on_submit():
        user.firstname = edit_form.firstname.data
        user.lastname = edit_form.lastname.data
        user.email = edit_form.email.data
        db.session.commit()
        return redirect(url_for("view_members"))
    return render_template("add-member.html",
                           form=edit_form,
                           is_edit=True,
                           current_user=current_user)
Example #15
0
def register():
    member_form = MemberForm(request.form)
    if request.method == 'POST' and member_form.validate():
        username = member_form.username.data
        password = member_form.password.data
        name = member_form.name.data
        surname = member_form.surname.data
        e_mail = member_form.e_mail.data
        country = member_form.country.data
        user = User(username, password, name, surname, e_mail, country)
        user.save()
        flash('You were succesfully registered. Please login.', 'success')
        return redirect('/login')

    return render_template('register.html', form=member_form)
Example #16
0
def new_member():  #this is the function to add our new member
    flash("Welcome to this site")
    form = MemberForm()

    if request.method == 'POST' and form.validate_on_submit():
        member = Member()  #Instantiate the member model
        #call the save function and pass the forem and member arguments
        save(
            member, form, new=True
        )  #incase you want to add the picture _fn to be saved along with the data initially
        flash("Successfully created new member")
        return redirect(url_for('all_data'))  #redirect to the home page
    else:
        form = MemberForm()
        file_url = None

    return render_template('examples/member.html', form=form)
Example #17
0
def index():
    """新增用户"""
    g.__setattr__('action','member_manage')
    from forms import MemberForm
    form = MemberForm()

    if form.validate_on_submit():
        member = Member()

        form.populate_obj(member)
        db.session.add(member)
        db.session.commit()
        flash(u'添加成功!')

    members = Member.query.all()

    return render_template('/member/member.html',form=form,members=members)
Example #18
0
    def get_context_data(self, **kwargs):
        context = super(MemberEditView, self).get_context_data(**kwargs)
        member = Member.objects.get(auth_user=self.request.user)
        context['member'] = member
        context['form'] = MemberForm(instance=member)
        context['reset_form'] = PasswordResetForm()

        return context
Example #19
0
def index(request):
    if request.method == 'POST':
        params = request.POST

        if "action" in params and params[
                "action"] is not None and params["action"] != '':
            index = 0
            for member in members:
                if member['id'] == params["action"]:
                    del members[index]
                    break
                index = index + 1

            return render_to_response('index.html', {
                'form': MemberForm(),
                'members': members
            },
                                      context_instance=RequestContext(request))
        else:
            member_form = MemberForm(request.POST)

            if member_form.is_valid():
                mem_id = len(members)
                name = member_form.cleaned_data[
                    'last_name'] + ", " + member_form.cleaned_data['first_name']
                members.append({
                    'id': mem_id,
                    'name': name,
                    'email': member_form.cleaned_data['email'],
                    'status': member_form.cleaned_data['status']
                })
            return render_to_response('index.html', {
                'form': member_form,
                'members': members
            },
                                      context_instance=RequestContext(request))
    else:
        return render_to_response('index.html', {
            'form': MemberForm(),
            'members': members
        },
                                  context_instance=RequestContext(request))
def reister():
    form = MemberForm(
    )  #The request method brings about the frontend error in the template file ie "No file was chosen"
    #form = UploadForm()#The request method brings about the frontend error in the template file ie "No file was chosen"
    if request.method == 'POST' and form.validate_on_submit():
        member = Member()  #Instantiate the member model
        filename = photos.save(form.photo.data)
        file_url = photos.url(filename)
        f_name, f_ext = os.path.splitext(filename)
        picture_fn = f_name + f_ext
        #member.image_file = picture_fn
        save(
            member, form, picture_fn, new=True
        )  #The picture filename is passed as an arguement to the save function
        flash("Successfully created new member")

    else:
        file_url = None

    return render_template('image_load.html', form=form, file_url=file_url)
Example #21
0
def member_form(request, token):
    # fetch the orchestra from db by the token in the URL
    orchestra = _orchestra_by_token(token)

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

        if form.is_valid():
            member = form.save()
            member.orchestras.add(orchestra)
            member.late_registration = True
            member.save()

            member.send_confirm_email(orchestra)

            return redirect('confirm_member')
    else:
        form = MemberForm()

    return render(request, 'orkester/member_form.html',
                  {'form': form, 'orchestra': orchestra})
Example #22
0
def list_bills():
    bill_form = get_billform_for(g.project)
    # set the last selected payer as default choice if exists
    if 'last_selected_payer' in session:
        bill_form.payer.data = session['last_selected_payer']
    bills = g.project.get_bills()

    return render_template("list_bills.html",
                           bills=bills,
                           member_form=MemberForm(g.project),
                           bill_form=bill_form,
                           add_bill=request.values.get('add_bill', False))
Example #23
0
def add_member(request):
    memberForm=None
    tournament_start=False

    try:
        tournament_start=Tournament.objects.get(pk=1).start
    except Tournament.DoesNotExist:
        tournament_start=False
    if (tournament_start):
        messages.error(request,'Error! Tournament is started already')
    else:
        if request.POST:
            memberForm=MemberForm(request.POST)
            if memberForm.is_valid():
                memberForm.save()
                messages.success(request,'Information is added')
                memberForm=MemberForm()
            else:
                messages.error(request,'Error in fields')
        else:
            memberForm=MemberForm()





    return render_to_response('member_add.html',
        {'memberForm':memberForm},
        context_instance=RequestContext(request))
Example #24
0
def list_bills():
    bill_form = get_billform_for(g.project)
    # set the last selected payer as default choice if exists
    if 'last_selected_payer' in session:
        bill_form.payer.data = session['last_selected_payer']
    # Preload the "owers" relationship for all bills
    bills = g.project.get_bills().options(orm.subqueryload(Bill.owers))

    return render_template("list_bills.html",
                           bills=bills,
                           member_form=MemberForm(g.project),
                           bill_form=bill_form,
                           add_bill=request.values.get('add_bill', False))
Example #25
0
def add(request):
    if request.method == "POST":
        form = MemberForm(request.POST)
        if form.is_valid():
            obj = form.save()
            messages.success(request, 'Record has been saved successfully.')
            return HttpResponseRedirect(reverse("internal:members:detail", kwargs={'id':obj.id}))
        else:
            messages.error(request, 'Failed to save record. Please correct the errors below.', extra_tags='danger')
    else:
        form = MemberForm()

    context = {
        'page_header': "Add New Member",
        'page_title': "Add New Member",
        'form': form
    }

    return render(
        request,
        'members/add.html',
        context
    )
Example #26
0
def register_user(request):
    if request.method == 'POST':                         # if the form was submitted on page load,
        form = RegistrationForm(request.POST)            # retrieve the registration form
        form2 = MemberForm(request.POST, request.FILES)  # retrieve the mamber form
        if form.is_valid() and form2.is_valid():         # if both forms are filled in correctly,
            User.objects.create_user(                    # create a new user
                username=form.cleaned_data['username'],
                password=form.cleaned_data['password1'],
                email=form.cleaned_data['email']
                )
            user = authenticate( username=form.cleaned_data['username'], #ensure the new user is authenticated
                                 password=form.cleaned_data['password1'])
            login(request, user)                     # log the new user in
            member = form2.save(commit=False)        # save the member form without submitting to the database
            member.user = user                       # link the new user to the member object as a foriegn key
            member.save()                            # save and submit the new member object
            return HttpResponseRedirect(reverse('usdacm.views.profile', # redirect to this user's profile view
                                                args=(user.username,))) 
    else:                                            # else this is a GET request (a form was not submitted)
        form = RegistrationForm()                    # create a new registration form
        form2 = MemberForm()                         # create a new member form
    return render_to_response('usdacm/register_user.html',    # render registration page 
                              {'form': form, 'form2': form2}, # and pass it both forms
                              RequestContext(request)) 
Example #27
0
def edit_member(member_id):
    member = Person.query.get(member_id, g.project)
    if not member:
        raise werkzeug.exceptions.NotFound()
    form = MemberForm(g.project, edit=True)

    if request.method == 'POST' and form.validate():
        form.save(g.project, member)
        db.session.commit()
        flash(_("User '%(name)s' has been edited", name=member.name))
        return redirect(url_for(".list_bills"))

    form.fill(member)
    return render_template("edit_member.html", form=form, edit=True)
Example #28
0
def MemberFrame_view(request):
    # для iframe
    if request.method == "GET":
        print "--simply GET----"
        args = {}
        #_user = auth.get_user(request)
        _id = auth.get_user(request).id  # ИД авторизированного юзера
        try:
            args['members'] = (Member.objects.filter(user_id=_id))
        except ObjectDoesNotExist:
            args['members'] = " "
        # передаем экземпляр формы для добавления участника
        args['form'] = MemberForm()
        return render(request, 'tables/TableMembersChild.html', args
                      #context_instance = RequestContext(request, args)
                      )
Example #29
0
def CreateOrEditMember_view(request, member_id=None):
    if (member_id == None or member_id == '999999'):
        _member = Member()
        _message = 'Участник добавлен успешно'
    else:
        #_member = get_object_or_404( Member ,  id = member_id )
        _member = Member.objects.get(id=member_id)
        _message = 'Информация об участнике обновлена успешно'
    if request.method == "GET" and request.is_ajax():
        data = serializers.serialize('json', [
            _member,
        ],
                                     fields=('age_group', 'first_name',
                                             'last_name', 'age', 'gender',
                                             'status', 'status_comment'))
        return _json_response(data)

    if request.POST:
        response_data = {}  # словарь для JSON-ответа
        print request.POST

        formMember = MemberForm(request.POST, request.FILES, instance=_member)
        if formMember.is_valid():
            member = formMember.save(commit=False)
            member.user_id = auth.get_user(
                request
            ).id  #передаем  ID директора , к которому привязан участник
            # переписываем фамилию и имя с большой буквы
            member.first_name = formMember.cleaned_data['first_name'].title()
            member.last_name = formMember.cleaned_data['last_name'].title()
            # дата последнего редактирования самим руководителем
            member.date_change_dir = datetime.now()
            formMember.save()
            #messages.add_message(request, messages.SUCCESS, _message)
            return HttpResponse('ok')
        else:
            #_message = u'Неправильно заполнена форма'
            #messages.add_message(request, messages.ERROR, _message)
            response_data['errors'] = u'Неправильно заполнена форма'
            response_data['formErrors'] = simplejson.dumps(formMember.errors)
            return _json_response(response_data)
    else:
        args = {}
        args.update(csrf(request))
        args['form'] = MemberForm(instance=_member)
        args['user_id'] = auth.get_user(request).id
        return render_to_response('Create_member.html', args)
    #return redirect(reverse('Main'));
    return redirect('/')
Example #30
0
def edit_member(member_id):
    member = Person.query.get(member_id, g.project)
    if not member:
        raise werkzeug.exceptions.NotFound()
    form = MemberForm(g.project, edit=True)

    if request.method == 'POST' and form.validate():
        form.save(g.project, member)
        db.session.commit()
        flash(_("User '%(name)s' has been edited", name=member.name))
        return redirect(url_for(".list_bills"))

    form.fill(member)
    return render_template("edit_member.html", form=form, edit=True)
Example #31
0
def home(request):
	try:
		member = Member.objects.get(user=request.user)
		registration_complete = True

		# We have a batch job that expires members, but do it here as well to make sure
		# the web is up to date with information if necessary.
		if member.paiduntil and member.paiduntil < date.today():
			MemberLog(member=member,
					  timestamp=datetime.now(),
					  message="Membership expired").save()
			member.membersince = None
			member.paiduntil = None
			member.save()

	except Member.DoesNotExist:
		# No record yet, so we create one. Base the information on whatever we
		# have already.
		member = Member(user=request.user, fullname=request.user.first_name)
		registration_complete = False

	if request.method == "POST":
		form = MemberForm(data=request.POST, instance=member)
		if form.is_valid():
			member = form.save(commit=False)
			member.user = request.user
			member.save()
			if not registration_complete:
				MemberLog(member=member,
						  timestamp=datetime.now(),
						  message="Registration received, awaiting payment").save()
				registration_complete = True # So we show the payment info!
			elif form.has_changed():
				# Figure out what changed
				MemberLog(member=member,
						  timestamp=datetime.now(),
						  message="Modified registration data for field(s): %s" % (", ".join(form._changed_data)),
						  ).save()
			if request.POST["submit"] == "Generate invoice":
				# Generate an invoice for the user
				if member.activeinvoice:
					raise Exception("This should not happen - generating invoice when one already exists!")
				manager = InvoiceManager()
				processor = InvoiceProcessor.objects.get(processorname="membership processor")
				invoicerows = [('PostgreSQL Europe - 2 years membership - %s' % request.user.email, 1, 10),]
				member.activeinvoice = manager.create_invoice(
					request.user,
					request.user.email,
					request.user.first_name + ' ' + request.user.last_name,
					'', # We don't have an address
					'PostgreSQL Europe membership for %s'% request.user.email,
					datetime.now(),
					datetime.now(),
					invoicerows,
					processor = processor,
					processorid = member.pk,
					bankinfo = False,
					accounting_account = settings.ACCOUNTING_MEMBERSHIP_ACCOUNT
					)
				member.activeinvoice.save()
				member.save()

				# We'll redirect back to the same page, so make sure
				# someone doing say a hard refresh on the page doesn't
				# cause weird things to happen.
				return HttpResponseRedirect('/membership/')
	else:
		form = MemberForm(instance=member)

	logdata = MemberLog.objects.filter(member=member).order_by('-timestamp')[:30]

	return render_to_response('membership/index.html', {
		'form': form,
		'member': member,
		'invoice': InvoicePresentationWrapper(member.activeinvoice, "%s/membership/" % settings.SITEBASE_SSL),
		'registration_complete': registration_complete,
		'logdata': logdata,
		'amount': 10, # price for two years
	}, context_instance=RequestContext(request))
Example #32
0
 def post(self, request, *args, **kwargs):
     id = int(request.POST['member_id'])
     member = Member.objects.get(pk=id)
     form = MemberForm(request.POST, request.FILES, instance=member)
     form.save()
     return render(request, self.template_name)
Example #33
0
def member_form_submit(request):
	try:
		model_settings = Setting.objects.get()
	except Setting.DoesNotExist:
		model_settings = None

	if request.method == 'GET':
		data = {
			'static_url': settings.STATIC_FILE_URL_BASE,
			'settings': model_settings,
			'pages': Page.objects.all(),
			'form': MemberForm(),
		}

		return render(request, 'member_form.html', data)

	if request.method == 'POST':
		form = MemberForm(request.POST)
		if form.is_valid():
			data = request.POST.dict()
			body = 'MarmaraGNU için yeni bir üyelik başvurusu var!\n\n\n'
			body += 'Nickname: ' + form.cleaned_data['nickname'] + '\n\n'
			body += 'Ad soyad: ' + form.cleaned_data['name'] + '\n\n'
			body += 'E-posta: ' + form.cleaned_data['email'] + '\n\n'
			body += 'E-posta görünürlüğü: ' + form.cleaned_data['email_visibility'] + '\n\n'
			if 'institution' in request.POST:
				body += 'Okuduğu/Çalıştığı kurum: ' + form.cleaned_data['institution'] + '\n\n'
			if 'department' in request.POST:
				body += 'Okuduğu bölüm/Pozisyon: ' + form.cleaned_data['department'] + '\n\n'
			if 'irc' in request.POST:
				body += 'IRC nickname: ' + form.cleaned_data['irc'] + '\n\n'
			if 'twitter' in request.POST:
				body += 'Twitter kullanıcı adı: ' + form.cleaned_data['twitter'] + '\n\n'
			if 'github' in request.POST:
				body += 'Github kullanıcı adı: ' + form.cleaned_data['github'] + '\n\n'
			if 'teams' in request.POST:
				body += 'Yer almak istediği ekip(ler):\n'
				for team in form.cleaned_data['teams']:
					body += team + ', '
				body += '\n\n'
			if 'description' in request.POST:
				body += 'Detaylar: ' + form.cleaned_data['description']
			send_mail(
				'Üyelik Başvuru Formu',
				body,
				'MarmaraGNU <*****@*****.**>',
				['*****@*****.**'],
				fail_silently=True
			)
			return_data = {
				'static_url': settings.STATIC_FILE_URL_BASE,
				'settings': model_settings,
				'pages': Page.objects.all(),
				'form': MemberForm(),
				'success_message': 'Başvurunuz işleme alındı. Kısa bir süre sonra sizinle iletişime geçeceğiz. Teşekkürler.',
			}

			return render(request, 'member_form.html', return_data)
		else:
			data = {
				'static_url': settings.STATIC_FILE_URL_BASE,
				'settings': model_settings,
				'pages': Page.objects.all(),
				'form': MemberForm(request.POST),
				'error_message': 'Lütfen gerekli alanları doldurunuz.',
			}

			return render(request, 'member_form.html', data)
Example #34
0
def home(request):

    _user = auth.get_user(request)

    if _user.is_superuser:
        return redirect('/admin')
    if not _user.is_authenticated():
        #return redirect('/login');
        print '-----redirect'
        return redirect(reverse('login'))
    else:
        _id = auth.get_user(request).id  # ИД авторизированного юзера

        # отменили пока проверку 2016.04.04
        ## проверяем заполено ли в профиле поле с e-mail и имя коллектива, если нет , отправляем заполнять
        #print "---mail is : -------"
        #print Director.objects.get(user_id = _id).email
        #if (Director.objects.get(user_id = _id).email in ['', None]) or \
        #    (Director.objects.get(user_id = _id).groupName in ['', None]):
        #    return redirect(reverse('editDir'))

        args = {}
        args.update(csrf(request))
        args['title'] = u'Главная'

        args['username'] = auth.get_user(request).username
        # profile
        try:
            args['directorOfGroup'] = Director.objects.get(user_id=_id)
        except ObjectDoesNotExist:
            args['directorOfGroup'] = " "
        # --news--
        try:
            args['news'] = News.objects.order_by(
                'id').reverse()[:3]  # берем только 3 последние новости
        except ObjectDoesNotExist:
            args['news'] = " "
        #-- member--
        try:
            args['members'] = (Member.objects.filter(user_id=_id))
        except ObjectDoesNotExist:
            args['members'] = " "
        # передаем экземпляр формы для добавления участника
        args['form'] = MemberForm()

        # передаем форму для загрузки фотки
        args['formFoto'] = DirectorUploadFile()
        # передаем форму для редактирования профиля
        args['formEditDir'] = DirectorEditForm(instance=get_object_or_404(
            Director, user_id=_id))  #Director.objects.get(user_id =_id) )

        #--Particapation--
        try:
            args['participation'] = (Participation.objects.filter(user_id=_id,
                                                                  fest_num=2))
        except ObjectDoesNotExist:
            args['participation'] = " "
        args['formParticipation'] = ParticipationForm(_user=_id)
        #сумма оргвзноса за заявки на участие
        sumParticipation = 0
        for parton in Participation.objects.filter(user_id=_id):
            sumParticipation += parton.payment
        args['sumParticipation'] = sumParticipation
        #print "---print Participation================"
        #print sumParticipation
        #--Residing--
        try:
            args['residing'] = (Residing.objects.filter(user_id=_id,
                                                        fest_num=2))
        except ObjectDoesNotExist:
            args['residing'] = " "
        args['formResiding'] = ResidingForm(_user=_id)

        #--Transfer--
        try:
            args['transfers'] = (Transfer.objects.filter(user_id=_id,
                                                         fest_num=2))
        except ObjectDoesNotExist:
            args['transfers'] = " "
        args['formTransfer'] = TransferForm(
            _user=_id)  # передаем параметр для фильтрации место прибытия
        #--Excursion
        try:
            args['excursions'] = (Excursion.objects.filter(user_id=_id,
                                                           fest_num=2))
        except ObjectDoesNotExist:
            args['excursions'] = " "
        args['formExcursion'] = ExcursionForm(_user=_id)

        #--Food--
        try:
            args['foods'] = (Food.objects.filter(user_id=_id, fest_num=2))
        except ObjectDoesNotExist:
            args['foods'] = " "
        args['formFood'] = FoodForm(_user=_id)

        args['year'] = datetime.now().year

        #return render_to_response('Member_raduga_template.html'  ,  args , context_instance=RequestContext(request))
        return render(
            request,
            'Member_raduga_template.html',  #args )                
            context_instance=RequestContext(
                request, args)  # old version render , prior 1.10 
        )