hi everyone!

i am looking for solutions with regards to templates directory . . i have 
this results.html where the data should be displayed after it is queried 
through views.py. . it should display the barangay id and the name of the 
barangay itself. . 


*{% block content %}
{% if results %}
  {% for result in results %}
    {{ result.id }}
    {{ result.barangay }}
  {% endfor %}
{% else %}
    <h3 class='error'>Please enter a valid UID</h3>
    <form method="get" action="/search/">
      Search Barangay: <input type="text" name="q" id="id_q" value="{{ query    
 }}"/>
      <input type="submit" value="Search" />
    </form>
{% endif %}

{% endblock %}*

i have also views.py that queries data from the postgresql

*from django.template import RequestContext
def search(request):

    query = request.GET.get('q')
    try:
        query = int(query)
    except ValueError:
        query = None
        results = None
    if query:

        results = Butuan_Parcel.objects.get(id=query)

    context = RequestContext(request)

    return render('results.html', {"results": results}, 
context_instance=context)*


i want also to know what am i missing with this. .urls.py

*(r'search', search)*


when I search id in my index.html , the system can retrieve the data but it 
gives me an error 
TemplateDoesNotExist at /search/. . what am I missing?? 
it was also suggested to to declare my template directories 
so i declared this in my settings.py



*PROJECT_PATH = os.path.dirname(os.path.abspath(__file__))TEMPLATE_DIRS = 
(PROJECT_PATH+'/Apps/templates'*)

yet, nothing has worked . .i still get the error. . can anyone suggest 
solutions with my problem?? Thanks in advance. .

-- 
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/6a0bc697-05bc-4952-9cd1-705422b9bbba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to