I have a functioning Django application that is based on sqlite3, 
but I want to change to using Postgres.
I have altered the DATABASES clause in settings.py to use Postgres.
and I am using Django version 1.7.

Am I correct that use of "python makemigrations" followed by
"python migrate", should copy the existing data into Postgres
and leave me with a working application?

Instead what is happening is that "python migrate" gives
the following error and hint:

  django.db.utils.ProgrammingError: column "date" cannot be cast 
automatically to type integer
  HINT:  Specify a USING expression to perform the conversion.

How can I apply this hint to make this work?

My models.py file is as follows:
----------------
from django.db import models
import datetime

# Create your models here.

class Location(models.Model):

   class Meta:
      unique_together = ("lat", "lng")

   lat  = models.DecimalField(max_digits=8, decimal_places=5)
   lng  = models.DecimalField(max_digits=8, decimal_places=5)
   name = models.CharField(max_length=200,  unique=True)

   def __str__(self):
      return "%s: %d %d" % (self.name, self.lat, self.lng)

class Observation(models.Model):

   date     = models.DateField()
   location = models.ForeignKey(Location)
   observer = models.CharField(max_length=50)
   temperature     = models.FloatField(default=0.0)
   photo    = models.ImageField(default="tower.jpg", 
upload_to="uploaded_photos")

   def __str__(self):
      return self.observer
---------------

Thanks.






-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/82208bed-4d02-49b5-83b2-f6302fa889b1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to