I am using Geomanager for storing MultiPolygon data.
I have below tables:
il
class Customer(gismodels.Model):
    is_active = models.CharField(max_length=15, default="Inactive", 
choices= ACTIVE_CHOICES)
    name = models.CharField(max_length=255)
    organisation_name = models.CharField(max_length=100, blank = True)
    rating = 
models.CharField(max_length=25,choices=RATING_CHOICES,null=True, blank=True)
    description = models.TextField(max_length=255, blank=True)
    email_primary = models.EmailField(max_length=1000 ,null=False, 
default="test...@gmail.com")
    email_secondary = models.EmailField(max_length=1000 ,null=True, 
blank=True)
    phone_primary = models.CharField(max_length=1000)
    phone_secondary = models.CharField(max_length=1000, null=True, 
blank=True)
    address = models.CharField(max_length=2000, blank=True)
    has_shop = models.CharField(max_length=128, verbose_name="Does he have 
a shop?", choices=[('Yes', 'Yes'),('No', 'No')],blank=True)
    working_hours_start = 
models.CharField(max_length=12,blank=True,verbose_name="What is the 
    website = models.URLField(blank=True, null=True)
    expertise = models.CharField(max_length=2000, blank=True)
    experience = models.CharField(max_length=12, null=True, blank=True)
    city = models.ForeignKey(City, null=True)
    country = 
models.CharField(max_length=255,choices=COUNTRY_CHOICES,null=True, 
blank=True)
    multi_poly = gismodels.MultiPolygonField(srid=4326, null=True, 
blank=True,verbose_name="Service Locations")
    objects = gismodels.GeoManager()
    
    class Meta:
        db_table = 'customer'
        verbose_name = 'Customer'
        verbose_name_plural = 'Customers'


class Logs(models.Model)
    '''logs Info'''
    merchant = models.ForeignKey(Merchant, verbose_name='Merchant')
    message = models.TextField(max_length=255, blank=True)
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)

So from shell when i try to access merchant from logs object i get error
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File 
"/home/web/Search/local/lib/python2.7/site-packages/django/db/models/fields/related.py",
 
line 572, in __get__
    rel_obj = qs.get()
  File 
"/home/web/Search/local/lib/python2.7/site-packages/django/db/models/query.py", 
line 351, in get
    num = len(clone)
  File 
"/home/web/Search/local/lib/python2.7/site-packages/django/db/models/query.py", 
line 122, in __len__
    self._fetch_all()
  File 
"/home/web/Search/local/lib/python2.7/site-packages/django/db/models/query.py", 
line 966, in _fetch_all
    self._result_cache = list(self.iterator())
  File 
"/home/web/Search/local/lib/python2.7/site-packages/django/db/models/query.py", 
line 265, in iterator
    for row in compiler.results_iter():
  File 
"/home/web/Search/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py",
 
line 700, in results_iter
    for rows in self.execute_sql(MULTI):
  File 
"/home/web/Search/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py",
 
line 786, in execute_sql
    cursor.execute(sql, params)
  File 
"/home/web/Search/local/lib/python2.7/site-packages/django/db/backends/utils.py",
 
line 81, in execute
    return super(CursorDebugWrapper, self).execute(sql, params)
  File 
"/home/web/Search/local/lib/python2.7/site-packages/django/db/backends/utils.py",
 
line 65, in execute
    return self.cursor.execute(sql, params)
  File 
"/home/web/Search/local/lib/python2.7/site-packages/django/db/utils.py", 
line 94, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File 
"/home/web/Search/local/lib/python2.7/site-packages/django/db/backends/utils.py",
 
line 65, in execute
    return self.cursor.execute(sql, params)
  File 
"/home/web/Search/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py",
 
line 128, in execute
    return self.cursor.execute(query, args)
  File 
"/home/web/Search/local/lib/python2.7/site-packages/MySQLdb/cursors.py", 
line 205, in execute
    self.errorhandler(self, exc, value)
  File 
"/home/web/Search/local/lib/python2.7/site-packages/MySQLdb/connections.py", 
line 36, in defaulterrorhandler
    raise errorclass, errorvalue
OperationalError: (1054, "Unknown column 'customer.city_id' in 'field 
list'")

-- 
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/910f8f8d-c2c3-4a72-b95e-3edbd96eafc4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to