from django.shortcuts import render
from django import forms

def contact_admin(request):
    return render(request, 'contact_admin/form.html', {})
@@ -58,36 +58,1586 @@
 rms%0A
-%0Adef contact_admin(request):
+from django.core.mail import send_mail%0Afrom django.http import HttpResponseRedirect%0Afrom django.core.urlresolvers import reverse%0A%0Afrom studentsdb.settings import ADMIN_EMAIL%0A%0Aclass ContactForm(forms.Form):%0A    from_email = forms.EmailField(%0A        label=%22%D0%92%D0%B0%D1%88%D0%B0 %D0%95%D0%BC%D0%B5%D0%B9%D0%BB %D0%90%D0%B4%D1%80%D0%B5%D1%81%D0%B0%22)%0A%0A    subject = forms.CharField(%0A        label=%22%D0%97%D0%B0%D0%B3%D0%BE%D0%BB%D0%BE%D0%B2%D0%BE%D0%BA %D0%BB%D0%B8%D1%81%D1%82%D0%B0%22,%0A        max_length=128)%0A%0A    message = forms.CharField(%0A        label=%22%D0%A2%D0%B5%D0%BA%D1%81%D1%82 %D0%BF%D0%BE%D0%B2%D1%96%D0%B4%D0%BE%D0%BC%D0%BB%D0%B5%D0%BD%D0%BD%D1%8F%22,%0A        max_length=2560,%0A        widget=forms.Textarea)%0A    %0A%0Adef contact_admin(request):%0A    # check if form was posted%0A    if request.method == 'POST':%0A        # create a form instance and populate it with data from the request%0A        form = ContactForm(request.POST)%0A%0A        # check whether user data is valid:%0A        if form.is_valid():%0A            #send email%0A            subject = form.cleaned_data%5B'subject'%5D%0A            message = form.cleaned_data%5B'message'%5D%0A            from_email = form.cleaned_data%5B'from_email'%5D%0A%0A            try:%0A                send_mail(subject, message, from_email, %5BADMIN_EMAIL%5D)%0A            except Exception:%0A                message = %22%D0%9F%D1%96%D0%B4 %D1%87%D0%B0%D1%81 %D0%B2%D1%96%D0%B4%D0%BF%D1%80%D0%B0%D0%B2%D0%BA%D0%B8 %D0%BB%D0%B8%D1%81%D1%82%D0%B0 %D0%B2%D0%B8%D0%BD%D0%B8%D0%BA%D0%BB%D0%B0 %D0%BD%D0%B5%D0%BF%D0%B5%D1%80%D0%B4%D0%B1%D0%B0%D1%87%D1%83%D0%B2%D0%B0%D0%BD%D0%B0 %D0%BF%D0%BE%D0%BC%D0%B8%D0%BB%D0%BA%D0%B0. %5C%0A                    %D0%A1%D0%BF%D1%80%D0%BE%D0%B1%D1%83%D0%B9%D1%82%D0%B5 %D1%81%D0%BA%D0%BE%D1%80%D0%B8%D1%81%D1%82%D0%B0%D1%82%D0%B8%D1%81%D1%8F %D0%B4%D0%B0%D0%BD%D0%BE%D1%8E %D1%84%D0%BE%D1%80%D0%BC%D0%BE%D1%8E %D0%BF%D1%96%D0%B7%D0%BD%D1%96%D1%88%D0%B5%22%0A            else:%0A                massage = %22%D0%BF%D0%BE%D0%B2%D1%96%D0%B4%D0%BE%D0%BC%D0%BB%D0%B5%D0%BD%D0%BD%D1%8F %D1%83%D1%81%D0%BF%D1%96%D1%88%D0%BD%D0%BE %D0%BD%D0%B0%D0%B4%D1%96%D1%81%D0%BB%D0%B0%D0%BD%D0%B5!%22%0A%0A            # redirect to same contact page with success message%0A            return HttpResponseRedirect(%0A                '%25s?status_message=%25s') %25 (reverse('contact_admin'), message)%0A%0A    # if there was not POST render blank form%0A    else:%0A        form = ContactForm()%0A
 %0A   
@@ -1688,10 +1688,22 @@
 html', %7B
+'form': form
 %7D)

add logik to contact_admin view