python - How to call a specific attribute from views? -


i have application tests if value greater attribute configurationform. if true, sends email e_mail attribute of configuration form.

these views , form files. don't know how call attribute?

views.py

from django.shortcuts import render, render_to_response choix.forms import configurationform django.http import httpresponse, httpresponseredirect django.core.urlresolvers import reverse choix.models import configuration  django import forms  rasp import foo django.core.mail import send_mail, badheadererror   def index(request):     x = configuration.objects.temperature()     = configuration.objects.e_mail()     l = foo()     subject = request.post.get('subject', 'subject')     message = request.post.get('message', 'attention ! la temperature depasse le maximum ')     from_email = request.post.get('from_email', '**********@gmail.com')     in range(len(l)):         if l[i] > 14:               if subject , message , from_email:                   try:                       send_mail(subject, message, from_email, [to])                       return func(request)                   except badheadererror:                       return httpresponse('invalid header found.')                   return httpresponseredirect('mail')               else:                   return httpresponse('make sure fields entered , valid.')     return func(request)   

forms.py

from django import forms models import configuration django.db import models    class configurationform(forms.form):      e_mail = forms.emailfield(initial='********@gmail.com')      temps = forms.integerfield(initial='3000')      temperature = forms.floatfield(initial='25.6') 


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -