送信ボタンをクリックしたときに、テンプレートから関数にドロップダウン変数を渡したい
#models.py :-
class donnee(models.Model):
name = models.CharField(_('name'), max_length= 150)
def __unicode__(self):
return self.name
class Meta:
verbose_name = _('donnee')
verbose_name_plural = _('donnees filtrage')
ordering = ['name']
class Property(models.Model):
name = models.CharField(_('name'), max_length=50)
description = models.TextField(_('description'), blank=True)
def __unicode__(self):
return self.name
class Meta:
verbose_name = _('property')
verbose_name_plural = _('properties')
ordering = ['name']
class Physic2(models.Model):
name = models.ForeignKey(Property, verbose_name=_('name'), null=True, blank=True)
lapropriete = models.ForeignKey(donnee, verbose_name=_('lapropriete'), blank=True)
#lapropriete = models.CharField(_('property'), max_length=100)
description = models.TextField(_('description'), blank=True)
def __unicode__(self):
return self.lapropriete
class Meta:
verbose_name = _('physic2')
verbose_name_plural = _('physics2')
ordering = ['name']
#forms.py:-
class Physic2Form(forms.ModelForm):
class Meta:
model = Physic2
#views.py:-
def get_materials_one(request, category_slug=None):
if category_slug is None:
lafamille= 'general'
propriete= Physic2Form()
return render_to_response('material/critere1.html',
{'unefamille': lafamille,
'propriete': propriete},
context_instance=RequestContext(request))
#template:-
<form id= "testjson" action="{% url chercher_filtre1 %}" method= "get" onsubmit = "">
{{ propriete.lapropriete }}
<td><input type="submit" style="background-color:#D7D8D4;" value="Search" id= "chercher"/></td>
</div>
</form>
#function:-
valT1 = request.GET['lapropriete']
this don't work
ドロップダウン リストのフィールドをクリックしたとき
valT1 = 1 または 2... フィールドの ID です
私はフィールドを持っています
ビッカース硬度 (GPa) せん断弾性率 (GPa) ヤング率 (GPa)
request.GET[ ??] に何を入れるか