The error is probably in code you wrote that uses the date field. Can you 
post the full traceback? That will let us see where the caller was that 
created the problem.

On Tuesday, February 17, 2015 at 3:13:30 PM UTC-5, tony....@gmail.com wrote:
>
> I have written a simple Django app (my first) that works with sqlite3 
> database.
> I want to change to postgres, but when I run the Django 1.7 migration 
> utility  with the command
> "python manage.py migrate"
>
> I get the error:
>     psycopg2.ProgrammingError: column "date" cannot be cast automatically 
> to type integer
>
> Which is occuring in:
>   File 
> "/usr/local/lib/python3.3/site-packages/django/db/backends/utils.py", line 
> 65, in execute
>     return self.cursor.execute(sql, params
>
> I am not sure how to track down the problem.
> I am running Slackware Linux.
>
> 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
> =========================================
>
> The DATABASE part of my settings.py file is as follows
> where I have commented-out the old sqlite3 part:
>
> -----------------------------------------------------------------
> DATABASES = {
>
> #   'default': {
> #       # sqllite3
> #       'ENGINE': 'django.db.backends.sqlite3',
> #       'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
> #   }
>
>    # For postgres:
>     #'django.db.backends.postgresql_psycopg2', 
>     # USER, PASSWORD, HOST also needed
>     # Inside postgres, "CREATE DATABASE database_name"
>
>      'default': {
>          'ENGINE': 'django.db.backends.postgresql_psycopg2',
>          'NAME': 'app_1_db',
>          'USER': 'bill',
>          'PASSWORD': 'bill',
>          'HOST': '127.0.0.1',
>          'PORT': '5432',
>      }
>
> }
>
> --------------------------------------------------------------------------------
>
> Please let me know if you have ideas.
>
> 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/df155cf9-9ba7-42fd-b9b2-2a78f433ca21%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to