On Fri, Jul 18, 2008 at 10:57 AM, Bram de Jong <[EMAIL PROTECTED]> wrote:
> > Hello all, > > just updated to latest newforms-admin (r7947) and.... > Do you know what level you updated from? That's always handy to know when trying to pinpoint when a problem was introduced. > This is the admin for one of my (rather large) models: > > class Sound(SocialModel): # SocialModel is a model that defines some > GenericRelation > user = models.ForeignKey(User) > # snip > license = models.ForeignKey(License) > geotag = models.ForeignKey(GeoTag, null=True, blank=True, default=None) > #snip > sources = models.ManyToManyField('self', symmetrical=False, > related_name='remixes', blank=True) > pack = models.ForeignKey('Pack', null=True, blank=True, default=None) > #snip > type = models.CharField(db_index=True, max_length=4, > choices=SOUND_TYPE_CHOICES) > #.... > > class SoundAdmin(admin.ModelAdmin): > raw_id_fields = ('user', 'pack', 'sources', 'geotag') > list_display = ('id', 'user', 'original_filename', 'license') > list_filter = ('processing_state', 'moderation_state', 'license') > fieldsets = ( > (None, {'fields': ('user', 'created', 'modified')}), > ('Filenames', {'fields': ('original_path', 'base_filename_slug')}), > ('User defined fields', {'fields': ('description', 'license', > 'geotag', 'original_filename', 'sources', 'pack')}), > ('File properties', {'fields': ('md5', 'type', 'duration', > 'bitrate', 'bitdepth', 'samplerate', 'filesize', 'channels')}), > ('Moderation', {'fields': ('moderation_state', > 'moderation_date', 'moderation_bad_description')}), > ('Processing', {'fields': ('processing_state', > 'processing_date', 'processing_log')}), > ) > admin.site.register(Sound, SoundAdmin) > > > And this is the error I get when validating: > So it's got something to do with validation. Do you know if it worked at all after validation of ModelAdmin was added (r7929) and has broken subsequently, or if it broke as soon as ModelAdmin validation was added? > [snip Traceback start] > 184. def fields_for_model(model, fields=None, exclude=None, > formfield_callback=lambda f: f.formfield()): > File > "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/db/models/fields/related.py" > in formfield > 685. defaults = {'form_class': forms.ModelChoiceField, > 'queryset': > self.rel.to._default_manager.complex_filter(self.rel.limit_choices_to)} > > Exception Type: AttributeError at /account/upload/ > Exception Value: 'str' object has no attribute '_default_manager' > > > The error goes away when I remove the fieldsets definition. > Determining which part of the fieldsets definition generates the error would be helpful. You might be able to determine it by looking at the local vars in the debug page. Alternatively you could experiment with removing pieces of it to see which field is causing the error. Basic fieldsets validation works (I'm sure it's got tests and I have models that use it and still work on current newforms-admin), so it's something specific to your model. If you could strip your models down to a reasonably simple testcase that displays the error it would be helpful. 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 -~----------~----~----~----~------~----~------~--~---