I'm using the lastest svn magic-removal branch code, but as I test a
blog project, I'v gotten an exception when I adding a post in admin:

Exception Type:         AttributeError
Exception Value:        'Post' object has no attribute 'get_tag_list'
Exception Location: 
        
c:\python24\lib\site-packages\django-0.91-py2.4.egg\django\db\models\fields\related.py
in flatten_data, line 411

I knew that I can use Descriptor fields to manipulate the tablewide
query, but it seems that many codes also using old-style query, just
like get_tag_list, but not the new-style tags.add(), etc.

 408.  def flatten_data(self, follow, obj = None):
 409. new_data = {}
 410. if obj:

 411. get_list_func = getattr(obj, 'get_%s_list' % self.rel.singular) ...

 412. instance_ids = [instance._get_pk_val() for instance in get_list_func()]
 413. if self.rel.raw_id_admin:
 414. new_data[self.name] = ",".join([str(id) for id in instance_ids])
 415. else:
 416. new_data[self.name] = instance_ids
 417. else:

If I forgot something?

My models are very simple:

-----------------------------------------------------------

from django.db import models

# Create your models here.

class Category(models.Model):
    title = models.CharField(_('Name'), maxlength=100)
    description = models.CharField(_('Description'), maxlength=100, blank=True)

    def __repr__(self):
        return self.title

    class Admin: pass

class Tag(models.Model):
    title = models.CharField(_('Tag Name'), maxlength=100)
    description = models.CharField(_('Description'), maxlength=100, blank=True)

    def __repr__(self):
        return self.title

    class Admin: pass

class Post(models.Model):
    title = models.CharField(_('Title'), maxlength=100)
    content = models.TextField(_('Content'))
    pubdate = models.DateTimeField(_('Pubdate'))
    tags = models.ManyToManyField(Tag)
    categories = models.ManyToManyField(Category)

    def __repr__(self):
        return self.title

    class Admin: pass

--
I like python!
My Blog: http://www.donews.net/limodou
NewEdit Maillist: http://groups.google.com/group/NewEdit

Reply via email to