Re: newforms-admin weird error ( 'str' object has no attribute '_default_manager' )
I am experiencing same error message with r8053, however my situation is a bit different: - commenting out fieldsets definition doesn't help, - everything works perfectly on local dev server and fails deployed through mod_wsgi and mod_python (I didn't try with fcgi) I managed to narrow down the problem to two models that are causing the problem, both have custom managers and one have overriden queryset method. Any help would be highly appreciated as I spent a lot of time on chasing this and really have no idea where I could look for possible solution. Thanks, Maciek Traceback: File "/web/django-trunk/django/core/handlers/base.py" in get_response 77. callback, callback_args, callback_kwargs = resolver.resolve( File "/web/django-trunk/django/core/urlresolvers.py" in resolve 238. for pattern in self.urlconf_module.urlpatterns: File "/web/django-trunk/django/core/urlresolvers.py" in _get_urlconf_module 262. raise ImproperlyConfigured, "Error while importing URLconf %r: %s" % (self.urlconf_name, e) Exception Type: ImproperlyConfigured at / Exception Value: Error while importing URLconf 'urls': 'str' object has no attribute '_default_manager' --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: newforms-admin weird error ( 'str' object has no attribute '_default_manager' )
On Fri, Jul 18, 2008 at 5:45 PM, Karen Tracey <[EMAIL PROTECTED]> wrote: > > 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. Sorry for not replying this earlier. Splitting my admin settings into admin.py modules, and updating to the latest trunk fixed this problem. - Bram --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: newforms-admin weird error ( 'str' object has no attribute '_default_manager' )
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 -~--~~~~--~~--~--~---
newforms-admin weird error ( 'str' object has no attribute '_default_manager' )
Hello all, just updated to latest newforms-admin (r7947) and 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: Traceback: File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/core/handlers/base.py" in get_response 85. response = callback(request, *callback_args, **callback_kwargs) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/contrib/auth/decorators.py" in __call__ 66. if self.test_func(request.user): File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/contrib/auth/middleware.py" in __get__ 5. request._cached_user = get_user(request) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/contrib/auth/__init__.py" in get_user 80. user_id = request.session[SESSION_KEY] File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/contrib/sessions/backends/base.py" in __getitem__ 33. return self._session[key] File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/contrib/sessions/backends/base.py" in _get_session 147. self._session_cache = self.load() File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/contrib/sessions/backends/db.py" in load 20. expire_date__gt=datetime.datetime.now() File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/db/models/manager.py" in get 82. return self.get_query_set().get(*args, **kwargs) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/db/models/query.py" in get 296. clone = self.filter(*args, **kwargs) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/db/models/query.py" in filter 479. return self._filter_or_exclude(False, *args, **kwargs) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/db/models/query.py" in _filter_or_exclude 497. clone.query.add_q(Q(*args, **kwargs)) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/db/models/sql/query.py" in add_q 1159. can_reuse=used_aliases) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/db/models/sql/query.py" in add_filter 1037. alias, True, allow_many, can_reuse=can_reuse) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/db/models/sql/query.py" in setup_joins 1197. field, model, direct, m2m = opts.get_field_by_name(name) File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/db/models/options.py" in get_field_by_name 274. cache = self.init_name_map() File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/db/models/options.py" in init_name_map 300. for f, model in self.get_all_related_m2m_objects_with_model(): File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/db/models/options.py" in get_all_related_m2m_objects_with_model 377. cache = self._fill_related_many_to_many_cache() File