Note that there are some explanatory texts on larger screens.

plurals
  1. PODjango and related_name
    text
    copied!<p>first im so sorry with my english, im new with Django, im from php + codeigniter.</p> <p>I have a problem with a <code>related_name</code>, the tables are fine, but the problem is that in the Select (DropDown) the data display is "bad", in this way: Tarifas_object:</p> <p>Html code:</p> <pre><code>&lt;option value="1"&gt;Tarifas object&lt;/option&gt; </code></pre> <p>how ill display the correct data?</p> <p>my model:</p> <pre><code>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'] </code></pre> <p>Thanks guys.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload