If you want the job offer of the current logged user it should be pretty simple using a filter like that:
jobsfound.filter(userdetail__user=request.user) But if i was you i would invert the order of these two filter like that: jobsfound = joblist.objects.filter(userdetail__user=request.user) jobsfound = jobsfound.filter(name__icontains=cd['jobsearchitem']) On Tue, Aug 17, 2010 at 4:20 PM, Niall <nobyr...@gmail.com> wrote: > 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<django-users%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- 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.