#2415: AutomaticManipulator with foreign keys and unique_together fails
------------------------------+---------------------------------------------
 Reporter:  [EMAIL PROTECTED]  |       Owner:  adrian
     Type:  defect            |      Status:  new   
 Priority:  normal            |   Milestone:        
Component:  Core framework    |     Version:  SVN   
 Severity:  normal            |    Keywords:        
------------------------------+---------------------------------------------
 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',
         )
 }}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/2415>
Django <http://code.djangoproject.org/>
The web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates
-~----------~----~----~----~------~----~------~--~---

Reply via email to