On Sun, Sep 21, 2008 at 5:29 PM, djandrow <[EMAIL PROTECTED]> wrote:

>
> Here is my model for entry;
>
> class Entry(models.Model):
>
>        entry_id = models.AutoField(primary_key=True)
>        entry_date = models.DateField(auto_now_add=True)
>        entry_title = models.CharField(max_length=70)
>        entry_content = models.TextField(max_length=5000)
>        entry_cat = models.ManyToManyField(Category)
>
>        def __unicode__(self):
>                return self.entry_title
>
>
So entry_cat is not a character field, meaning you cannot directly filter on
it with a text value like you were trying to.  Instead of:

current_entries =
Entry.objects.filter(entry_cat=category).order_by("-entry_date")

you probably want something more like:

current_entries =
Entry.objects.filter(entry_cat__category_name=category).order_by("-entry_date")

(Here I'm guessing your Category model has a character-type field named
'category_name' that is what you really want to be matching -- you'll need
to fill in the actual field name from your Category model that you want to
match against.)

Karen

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to