Hi,
 i am trying to do a simple Django application where employee list is read
from database and displayed. for that i defined the models and entered the
values to database through Django admin. But while trying to display data
from database i am stuck with an error, "ViewDoesNotExist at
/employeeProfile/ : Could not import task.employeeDetails.views. Error was:
cannot import name emp_profile ".I am relatively new to django,so please
help me to solve this. This is the code

*VIEWS.PY *
from django.shortcuts import render_to_response
 from django.contrib.auth.models import*
from task.employeeDetails.models import *
 from django.conf import settings
from django.http import HttpResponse
from task.employeeDetails import emp_profile

def employeeList(request): tableList = EmployeeDetails.objects.all() return
render_to_response('employeeList.html', {'emp_list': tableList})

def employeeProfile(request): profile = EmployeeDetails.objects.all() return
render_to_response('employeeProfile.html',{'emp_profile':emp_profile})

*URLS.PY*

(r'^employeeProfile/$','task.employeeDetails.views.employeeProfile'),

*TEMPLATE *

{%for emp in emp_profile%} {{ emp.userName }} {{ emp.designation }} {{
emp.employeeID }} {%endfor%}

*MODELS.PY*

from django.db import models
class EmployeeDetails(models.Model):
    userName = models.CharField(max_length=200)
    designation = models.CharField(max_length=200)
    employeeID = models.IntegerField()
    contactNumber = models.IntegerField()
    project = models.CharField(max_length=200)
    dateOfJoin=models.DateField()


Thanks & Regards,

Ravi Krishna
My profiles: [image:
Facebook]<http://www.facebook.com/profile.php?id=578709891> [image:
LinkedIn] <http://www.linkedin.com/profile/edit?id=65129620&trk=hb_pro> [image:
Twitter] <http://twitter.com/ravi_krishna>
<http://www.wisestamp.com/email-install?utm_source=extension&utm_medium=email&utm_campaign=footer>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to