django haystack not wokring if my app name start with "capital letters"

Implementation search feature using django haystack ,by mistake my app name star with Capital latter and i have too much data in tables and django haystack not working, plz help am really stuck with this problem what shoul i do any suggestion.

project name “testpro”
setting.py

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'haystack',
    'rest_framework',
    'Newapp',
)

models.py


class Test(models.Model):
    newfield=models.CharField(max_length=452)


search_index.py


from haystack import indexes
from .models import *


class NewIndex(indexes.SearchIndex, indexes.Indexable):

    text = indexes.CharField(document=True, use_template=True)
    testfield = indexes.CharField(model_attr='newfield')


    def get_model(self):
        return Test

    def index_queryset(self, using=None):

        return self.get_model().objects.all()



test_text.txt and location :/testpro/Newapp/templates/search/indexes/Newapp

{{ object.newfield }}


DataBase Schema 

Schema |            Name            | Type  |   Owner
--------+----------------------------+-------+------------
 public | Newapp_test                | table | innot
 public | auth_group                 | table | innot
 public | auth_group_permissions     | table | innot
 public | auth_permission            | table | innot
 public | auth_user                  | table | innot
 public | auth_user_groups           | table | innot
 public | auth_user_user_permissions | table | innot
 public | django_admin_log           | table | innot
 public | django_content_type        | table | innot
 public | django_migrations          | table | innot
 public | django_session             | table | innot

plz help


Source: python

Leave a Reply