Hello everyone, i am creating a django powered blog.
Here is my simplified model

class Entry(models.Model):
        [...]
        tags = models.ManyToManyField(Tag)

       def save(self):
                super(Entry, self).save()
                print self.tags.all()

class Tag(models.Model):
        name = models.CharField(maxlength=200, core=True)
        total_ref = models.IntegerField(blank=True, null=True)

when i add an entry throught admin panel self.tags.all() is empty "[]"
but the tags exists, when i update an already existing entry it get
display ini the shell well.

>From  ubernostrum explainations :
That database table will have three columns: one is an integer primary
key, the other two are integers -- one referring to an Entry id and the
other to a Tag id.
When you create a new Entry, there is no id for that Entry in the Entry
table until after save() has completed.
 Which means that there can't be anything in the entry_tags table
referring to it until after save() has completed.

In which case, how could i keep track of how many entries contains the
Tag "foo" in their tag list for example ? Is my only solution a count
query ? the whole purpose is to then do a tag cloud.

Thanks for the help.


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to