When attempting to use model.AddManipulator?() on a model with both unique_together and a foreign key reference, the AddManipulator? fails with the following traceback.
Removing either the foreign key, or the unique_together, and .AddManipulator?() proceeds without issue.
>>> import notes.models as models
b>>> blah = models.Note.AddManipulator()
Traceback (most recent call last):
File "<console>", line 1, in ?
File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/models/manipulators.py", line 75, in __init__
self.fields.extend(f.get_manipulator_fields(self.opts, self, self.change, fol))
File "/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/models/related.py", line 116, in get_manipulator_fields
if follow.get(f.name, False):
AttributeError: 'bool' object has no attribute 'get'
>>>
The model in question is :
class Note(models.Model):
id = models.AutoField(primary_key=True)
parent = models.ForeignKey("self", blank=True, null=True, help_text='If left blank, a new top \
level note will be created', related_name='self_parent'
)
created = models.DateField(auto_now=True) # Each revision will be Now-Ified.
company = models.ForeignKey(Company, blank=True, core=True, edit_inline=models.STACKED, num_in_admin=1, null=True, help_text='A company may be blank',validator_list=[ \
myValidators.RequiredIfOtherFieldsNotGiven('parent','people') ])
people = models.ForeignKey(People, blank=True, null=True, help_text="People may be blank.",
validator_list=[
myValidators.RequiredIfOtherFieldsNotGiven('parent','company'),
]
)
# topic = models.CharField('Topic',maxlength=250, help_text='Short description of the note')
note = models.TextField('Note', help_text='Bring on the info', validator_list = [validators.isNotEmpty('note',None),] )
auth_user = models.ForeignKey(auth_models.User) # The creator of this note.
sticky = models.BooleanField(default=False) # Doesn't need to be anything special
note_id = models.IntegerField() # part of the revision ID field. Will generally be populated.
revision = models.IntegerField() # the revision number.
def __repr__(self):
return str(self.created) + ' - ' + self.note[35:] # A slice of the note, as a description.
class _custom_meta:
revise_on = ['note_id','revision']
class Meta:
db_table = 'note'
unique_together = (('note_id','revision'),)
class Admin:
list_display = ('parent','created','company','people')
js = (
'/media/js/tinymce/jscripts/tiny_mce/tiny_mce.js',
'/media/js/admin/textarea.js',
)