I'm using this def to uppercase some data before sending it to the database, is working perfectly, the problem is that I need to do the same with all the data and they are 107 rows.
def save(self, force_insert=False, force_update=False):
self.nombre_contacto_15 = self.nombre_contacto_15.upper()
super(ExpedienteConsultaInicial, self).save(force_insert, force_update)
I believed that using all.upper will do it for all the model, but I was wrong :) I'm a Django Newbie.
models.py
class ExpedienteConsultaInicial(models.Model):
#Inicia Campos Estudios Solicitados
exam_de_lab_111 = models.ForeignKey(Servicios_laboratorios, related_name='C1Lx',blank=True, null=True)
fecha_de_solicitud_112 = models.DateField(max_length=10, null=True, blank=True)
fecha_laboracion_113 = models.DateField(max_length=10, null=True, blank=True)
observaciones= models.CharField(max_length=6000, null=True,blank=True)
def __unicode__(self):
return self.credencial_consultainicial
def save(self, force_insert=False, force_update=False):
self.nombre_miembro_1 = self.nombre_miembro_1.upper()
self.nombre_contacto_15 = self.nombre_contacto_15.upper()
super(ExpedienteConsultaInicial, self).save(force_insert, force_update)
If what you mean by 107 variables is that there are 107 rows in the database, you can open the Django shell with:
$ python manage.py shell
and from the Python shell import your database model:
>>> from myapp.models import MyModel
and run whatever you want on it:
>>> for o in MyModel.objects.all:
... o.nombre_contacto_15 = o.nombre_contacto_15.upper()
... o.save()
...
>>>