Ejemplo n.º 1
0
def form_name_view(request):
    form = forms.FormName()
    if request.method == 'POST':
        form = forms.FormName(request.POST)
        if form.is_valid():
            print("VALIDATION SUCCESS!")
            print("Name: " + form.cleaned_data['name'])
            print("Email: " + form.cleaned_data['email'])
            print("Textarea: " + form.cleaned_data['text'])
    return render(request, 'basicApp/form_page.html', {'form': form})
Ejemplo n.º 2
0
def form_name_view(request):
    form = forms.FormName()
    if request.method == 'POST':  #if form is submitted
        form = forms.FormName(request.POST)
        if form.is_valid():  #check if valid r not ...its auto validated
            print("validation successful")
            print("Name :" + form.cleaned_data['name'])
            print("Email :" + form.cleaned_data['email'])
            print("Text:" + form.cleaned_data['text'])

    return render(request, "first_app/form_page.html", {'form': form})
Ejemplo n.º 3
0
def forms_view(request):
    form = forms.FormName()
    if request.method == 'POST':
        form = forms.FormName(request.POST)
        if form.is_valid():
            print("Validated Successfully!")
            print("Name:", form.cleaned_data['name'])
            print("Email:", form.cleaned_data['email'])
            print("Text:", form.cleaned_data['text'])

    return render(request, 'first_app/form_page.html', {'form': form})
Ejemplo n.º 4
0
def formResponse(request):
    form = forms.FormName()

    if request.method == 'POST':
        form = forms.FormName(request.POST)
        if form.is_valid():
            print("Validation")
            print('name '+form.cleaned_data['name'])
            print('email '+form.cleaned_data['email'])
            print('text '+form.cleaned_data['text'])

    return render(request,'form_page.html',{'form':form})
Ejemplo n.º 5
0
def form(request):
    form = forms.FormName()
    if request.method == 'POST':
        form = forms.FormName(request.POST)

    if form.is_valid():
        print("VALIDATION SUCCESS!!")
        print("Name: " + form.cleaned_data['name'])
        print("Email: " + form.cleaned_data['email'])
        print("Text entered is: " + form.cleaned_data['text'])

    return render(request, 'first_app/forms.html', {'form': form})
Ejemplo n.º 6
0
def form(request):
    form = forms.FormName()

    if (request.method == 'POST'):
        # form = forms.FormName(data=request.POST)

        return HttpResponseRedirect(reverse('final'))

    else:
        form = forms.FormName()

    return render(request, 'first_app/form.html', {'form': form})
Ejemplo n.º 7
0
def form_name_view(request):
    form = forms.FormName()

    if request.method == 'POST':
        form = forms.FormName(request.POST)

        if form.is_valid():
            #Do something Here
            print("Validation successful")
            print("Name : " + form.cleaned_data['name'])
            print("Email: " + form.cleaned_data['email'])
            print("Text : " + form.cleaned_data['text'])
    return render(request, 'first_app/form_page.html', {'form': form})
Ejemplo n.º 8
0
def form_name_view(request):
    form = forms.FormName()

    if request.method == 'POST':
        form = forms.FormName(request.POST)

        if form.is_valid():
            # do something code here
            print('Validation success!')
            print('Name: ' + form.cleaned_data['name'])
            print('Email: ' + form.cleaned_data['email'])
            print('Text: ' + form.cleaned_data['text'])
    return render(request, 'first_app/form_page.html', {'form': form})
Ejemplo n.º 9
0
def form_name_view(request):
    form = forms.FormName()

    if request.method == "POST":
        form = forms.FormName(request.POST)

        if form.is_valid():
            print("validdatin success")
            print("Name: " + form.cleaned_data["name"])
            print("Email: " + form.cleaned_data["email"])
            print("Text: " + form.cleaned_data["text"])

    return render(request, "first_app/form_page.html", {"form": form})
Ejemplo n.º 10
0
def form_name_view(request):
    form = forms.FormName()
    if request.method == 'post':
        form = forms.FormName(request.post)

        if form.is_valid():
            #DO SOMETHING CODE
            print("VALIDATION SUCCESS!")
            print("NAME: " + form.cleaned_data['name'])
            print("EMAIL: " + form.cleaned_data['email'])
            print("TEXT: " + form.cleaned_data['text'])

    return render(request, 'first_app/form_page.html', {'form': form})
Ejemplo n.º 11
0
def form_name_view(request):
    form = forms.FormName()

    if request.method == 'POST':
        # we pass it that request
        form = forms.FormName(request.POST)

        # check to see form is valid
        if form.is_valid():
            print('form validation success prints in console!!')
            print('Name ' + form.cleaned_data['name'])
            print('Email ' + form.cleaned_data['email'])
            print('Text ' + form.cleaned_data['text'])
    return render(request, 'first_app/form_name.html', {'form': form})
Ejemplo n.º 12
0
def form_name_view(request):
    form = forms.FormName()

    if request.method == 'POST':

        form = forms.FormName(request.POST)

        if form.is_valid():
            print("form is valid")
            print('NAME:' + form.cleaned_data['name'])
            print('EMAIL:' + form.cleaned_data['email'])
            print('TEXT:' + form.cleaned_data['text'])

    return render(request, 'first_app/formtest.html', {'form': form})
Ejemplo n.º 13
0
def ViewForm(request):
    form = forms.FormName()

    if request.method == "POST":
        form = forms.FormName(request.POST)

        if form.is_valid():
            # Do something with data
            print("Data Validated")
            print(form.cleaned_data['name'])
            print(form.cleaned_data['email'])
            print(form.cleaned_data['text'])

    return render(request, 'forms.htm', context={'form': form})
Ejemplo n.º 14
0
def index(request):
    form = forms.FormName

    if request.method == 'POST':
        form = forms.FormName(request.POST)

        if form.is_valid():

            api = Twitter()
            tweets = api.get_tweets(query=form.cleaned_data['Tweet_Search'],
                                    count=50)
            counter = [0, 0, 0]
            percentage = [0, 0, 0]
            for tweet in tweets:
                analysis = TextBlob(api.clean(tweet[0]))
                if analysis.sentiment.polarity > 0:
                    counter[0] = counter[0] + 1
                elif analysis.sentiment.polarity == 0:
                    counter[1] = counter[1] + 1
                else:
                    counter[2] = counter[2] + 1
            percentage[0] = (counter[0] / sum(counter)) * 100
            percentage[1] = (counter[1] / sum(counter)) * 100
            percentage[2] = (counter[2] / sum(counter)) * 100
            mydict = {'tweets': tweets, 'counter': percentage, 'form': form}
            return render(request, 'index.html', context=mydict)
    return render(request, 'index.html', {'form': form})
Ejemplo n.º 15
0
def form_name(request):
    form = forms.FormName()
    # the above point to the class.

    if request.method == 'POST':
        form = forms.FormName(request.POST)
        print(request.POST)
        # request.POST give you a bunch of juicy stuff, like key values of form fields(name, email, text). As well as other jargon. THis is where you extract data.

        if form.is_valid():
            print("valid")
            print("Name: " + form.cleaned_data['name'])
            print("Email: " + form.cleaned_data['email'])
            print("Text: " + form.cleaned_data['text'])

    return render(request, 'first_app/form.html', {'form': form})
Ejemplo n.º 16
0
def form_name_view(request):
    form = FormName()

    if request.method == "POST":
        form = forms.FormName(request.POST)
        if form.is_valid():
            form.save(commit=True)
            return home(request)
        else:
            print("Error Form Invalid")

    return render(request, 'first_app/form_page.html', {'form': form})