[newforms-admin] prepopulate_from

243 views
Skip to first unread message

Almir Karic

unread,
Apr 10, 2008, 5:50:25 AM4/10/08
to django...@googlegroups.com
i have an error caused by the following line (which worked without
problems on regular django trunk)

slug = models.SlugField("url_prefix",max_length=50,unique=True,prepopulate_from=('name',),help_text='e.g.
"janez_marijan_potokar_novak" (PAZI, SUMNIKI)')

any ideas what am i doing wrong?

Traceback (most recent call last):
File "./manage.py", line 11, in <module>
execute_manager(settings)
File "/home/redduck666/django/newforms-admin/django/core/management/__init__.py",
line 272, in execute_manager
utility.execute()
File "/home/redduck666/django/newforms-admin/django/core/management/__init__.py",
line 219, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/redduck666/django/newforms-admin/django/core/management/base.py",
line 72, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/redduck666/django/newforms-admin/django/core/management/base.py",
line 86, in execute
output = self.handle(*args, **options)
File "/home/redduck666/django/newforms-admin/django/core/management/base.py",
line 168, in handle
return self.handle_noargs(**options)
File "/home/redduck666/django/newforms-admin/django/core/management/commands/validate.py",
line 9, in handle_noargs
self.validate(display_num_errors=True)
File "/home/redduck666/django/newforms-admin/django/core/management/base.py",
line 112, in validate
num_errors = get_validation_errors(s, app)
File "/home/redduck666/django/newforms-admin/django/core/management/validation.py",
line 28, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/home/redduck666/django/newforms-admin/django/db/models/loading.py",
line 126, in get_app_errors
self._populate()
File "/home/redduck666/django/newforms-admin/django/db/models/loading.py",
line 55, in _populate
self.load_app(app_name, True)
File "/home/redduck666/django/newforms-admin/django/db/models/loading.py",
line 70, in load_app
mod = __import__(app_name, {}, {}, ['models'])
File "/home/redduck666/django/varc/juno/../juno/mediaarchive/models.py",
line 176, in <module>
class Author(models.Model):
File "/home/redduck666/django/varc/juno/../juno/mediaarchive/models.py",
line 179, in Author
slug = models.SlugField("url_prefix",max_length=50,unique=True,prepopulate_from=('name',),help_text='e.g.
"janez_marijan_potokar_novak" (PAZI, SUMNIKI)')
File "/home/redduck666/django/newforms-admin/django/utils/maxlength.py",
line 47, in inner
func(self, *args, **kwargs)
File "/home/redduck666/django/newforms-admin/django/db/models/fields/__init__.py",
line 1019, in __init__
super(SlugField, self).__init__(*args, **kwargs)
File "/home/redduck666/django/newforms-admin/django/utils/maxlength.py",
line 47, in inner
func(self, *args, **kwargs)
File "/home/redduck666/django/newforms-admin/django/utils/maxlength.py",
line 47, in inner
func(self, *args, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'prepopulate_from'

--
error: one bad user found in front of screen

Daniel Roseman

unread,
Apr 10, 2008, 6:13:24 AM4/10/08
to Django users
On Apr 10, 10:50 am, "Almir Karic" <redduck...@gmail.com> wrote:
> i have an error caused by the following line (which worked without
> problems on regular django trunk)
>
> slug = models.SlugField("url_prefix",max_length=50,unique=True,prepopulate_from=('name',),help_text='e.g.
> "janez_marijan_potokar_novak" (PAZI, SUMNIKI)')
>
> any ideas what am i doing wrong?

<snip traceback>

If you're using newforms-admin, you should read this page carefully:
http://code.djangoproject.com/wiki/NewformsAdminBranch
The particular bit that applies to your code is the section headed
"Changed prepopulate_from to be defined in the Admin class, not
database field classes".
As described there, take the prepopulate_from attribute out of the
model definition and move it into the Admin class, so that it reads:
prepopulated_fields = {'slug': ('name',)}

--
DR

Almir Karic

unread,
Apr 10, 2008, 6:40:18 AM4/10/08
to django...@googlegroups.com

thanks :-)

Reply all
Reply to author
Forward
0 new messages