2009-07-29 7 views
0

私の英語ではすごくごめんなさい、Djangoで新しい、PHP + codeigniterからのim。Django and related_name

私はrelated_nameに問題がある、テーブルは罰金ですが、問題は、Select(ドロップダウン)でのデータ表示はこのように、「悪い」であるということです:Tarifas_object:

HTMLコード:

<option value="1">Tarifas object</option> 

どのように正しいデータを表示しますか?

私のモデル:

class Tarifas(models.Model): 
    recarga = models.CharField(max_length=7, help_text='Codigo de la tarifa') 
    precio = models.DecimalField(max_digits=7, decimal_places=2) 
    diligencias = models.PositiveIntegerField(max_length=3) 

    def __inicode__(self): 
     return self.precio 

    class Meta: 
     verbose_name_plural="Tarifas" 


class Recarga(models.Model): 
    socio = models.ForeignKey(User) 
    fecha = models.DateField(auto_now_add=True) 
    #valor = models.DecimalField(max_digits=6, decimal_places=2,verbose_name='Valor de la recarga', help_text= "Introduzca valores numericos ej.: 150.00") 
    valor = models.ForeignKey(Tarifas, related_name='recarga_valor') 
    diligencias = models.IntegerField(max_length=3, verbose_name='Cantidad de diligencias recargadas') 
    tiponcf = models.IntegerField(max_length=1,choices=TIPO_NCF, verbose_name='Tipo de comprobante fiscal') 
    ncf = models.CharField(max_length=19,verbose_name='Numero de comprobante fiscal') 
    cajero = models.CharField(max_length=20) 
    tipotarj = models.CharField(choices=TIPOS_TARJETAS, max_length=20, verbose_name='Tipo de tarjeta') 
    numtarj = models.IntegerField(max_length=16, verbose_name='Numero de tarjeta') 
    seguridad = models.IntegerField(max_length=3) 
    forma_pago = models.CharField(max_length=10, verbose_name='Forma de pago') 
    banco = models.CharField(max_length=20) 
    numerock = models.IntegerField(max_length=8, verbose_name='Numero de cheque') 

    def __unicode__(self): 
     return u'%s %s %s %s' % (self.socio,self.diligencias, self.fecha) 

    class Meta: 
     ordering = ['socio'] 

みんなありがとう。

答えて

2

モデルからそのままコピー&ペーストする場合は、Tarifasモデルのunicodeのスペルミスがあります。

関連する問題