Hey,
Given the models below, I want to display all jobs, but mark those of
the User that is logged in?


My Model definition---
User model is the built in User model.

class joblist(models.Model):
        name=models.CharField(...)
        userdetail = models.ManyToManyField(User,through='userextra')

class userextra(models.Model):
        joblist = models.ForeignKey(joblist)
        user = models.ForeignKey(User)
        comments= models.CharField(max_length=16384, blank=True,
null=True)


Views.py
jobsfound=joblist.objects.filter(name__icontains=cd['jobsearchitem'])


Template
{% for row in joblist %}{{row.name}}
{% if user.is_authenticated() %}
{{row.comments}}
{%endfor%}



I don't know if I should be adding more to the filter statement in
views.py or doing something in the template.
Note: I want all jobs printed (within the search criteria) but
displaying the comments of the authenticated user.


Any help appreciated,
N

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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