Programming error column does not exist
<p>models.py </p>

<pre><code>class PlansToLodge(models.Model):
sm_sequence = models.IntegerField()
sm_year = models.IntegerField()    
location = models.TextField(blank=True, null=True)
car_number = models.CharField(max_length=100, blank=True, null=True)
client_or_owner = models.TextField(blank=True, null=True)
date_received = models.DateField(blank=True, null=True)
date_lodged = models.DateField(blank=True, null=True)
remarks = models.TextField(blank=True, null=True)
sent_or_received = models.TextField(blank=True, null=True)    
receipt_number = models.TextField(blank=True, null=True)

class Meta:
    managed = False
    db_table = 'plans_to_lodge'
    unique_together = (('sm_sequence', 'sm_year'),)
</code></pre>

<p>view.py</p>

<pre><code>def searchPlanInfo(request):
logger = logging.getLogger(__name__)
if request.user.is_authenticated():
    if request.method =='POST':
        if request.POST['smYear'] is not '':
            searchPlan = request.POST['smYear']
            logger.error('lets see here')
            foundPlan = PlansToLodge.objects.filter(sm_year=searchPlan)
            logger.error(foundPlan[0])

            context = {'parcel_list': foundPlan}
            return render(request,'parcelmanager/index2.html',context)
        return HttpResponse("once again")
</code></pre>

<p>traceback</p>

<p>Traceback:</p>

<pre><code>File "C:\Users\yfevrier\Envs\landregtry1\lib\site-packages\django\core\handlers\base.py" in get_response
  132.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Sites\Landregistry\surveyplanmanager\views.py" in searchPlanInfo
  39.               logger.error(foundPlan[0])
File "C:\Users\yfevrier\Envs\landregtry1\lib\site-packages\django\db\models\query.py" in __getitem__
  201.         return list(qs)[0]
File "C:\Users\yfevrier\Envs\landregtry1\lib\site-packages\django\db\models\query.py" in __iter__
  162.         self._fetch_all()
File "C:\Users\yfevrier\Envs\landregtry1\lib\site-packages\django\db\models\query.py" in _fetch_all
  965.             self._result_cache = list(self.iterator())
File "C:\Users\yfevrier\Envs\landregtry1\lib\site-packages\django\db\models\query.py" in iterator
  238.         results = compiler.execute_sql()
File "C:\Users\yfevrier\Envs\landregtry1\lib\site-packages\django\db\models\sql\compiler.py" in execute_sql
  829.             cursor.execute(sql, params)
File "C:\Users\yfevrier\Envs\landregtry1\lib\site-packages\django\db\backends\utils.py" in execute
  79.             return super(CursorDebugWrapper, self).execute(sql, params)
File "C:\Users\yfevrier\Envs\landregtry1\lib\site-packages\django\db\backends\utils.py" in execute
  64.                 return self.cursor.execute(sql, params)
File "C:\Users\yfevrier\Envs\landregtry1\lib\site-packages\django\db\utils.py" in __exit__
  97.                 six.reraise(dj_exc_type, dj_exc_value, traceback)
File "C:\Users\yfevrier\Envs\landregtry1\lib\site-packages\django\utils\six.py" in reraise
  658.             raise value.with_traceback(tb)
File "C:\Users\yfevrier\Envs\landregtry1\lib\site-packages\django\db\backends\utils.py" in execute
  64.                 return self.cursor.execute(sql, params)

Exception Type: ProgrammingError at /surveyplanmanager/searchPlanInfo/
Exception Value: column plans_to_lodge.id does not exist
LINE 1: SELECT "plans_to_lodge"."id", "plans_to_lodge"."sm_sequence"...
               ^
</code></pre>

<p>now before i used sqlite  but we moved into what database we will be using Postgresql and i knew in sqlite it made these "id" fields but i dont know why its doing this for postgresql ive migrated and all so that shouldnt be happening </p>

<p>Actually this error occure because your database is not migrated</p>

<p>So run following command to migrate database</p>

<pre><code>python manage.py migrate
</code></pre>

<p>If this is not run then run following command</p>

<pre><code>python manage.py makemigrations
python manage.py migrate
</code></pre>

python django postgresql object models