I'm trying to use ModelAdmin.filter_horizontal and ModelAdmin.filter_vertical for ManyToMany field instead of select multiple box but all I get is:
My model:
class Title(models.Model):
#...
production_companies = models.ManyToManyField(Company, verbose_name="компании-производители")
#...
My admin:
class TitleAdmin(admin.ModelAdmin):
prepopulated_fields = {"slug": ("original_name",)}
filter_horizontal = ("production_companies",)
radio_fields = {"state": admin.HORIZONTAL}
#...
The javascripts are loading OK, I really don't get what happens. Django 1.1.1 stable.
To login to the site, open the /admin URL (e.g. http://127.0.0.1:8000/admin ) and enter your new superuser userid and password credentials (you'll be redirected to the login page, and then back to the /admin URL after you've entered your details).
To view the default admin template you can access it in the django/contrib/admin/templates/admin folder.
Run 'python manage.py migrate' to apply them. Username (leave blank to use 'chatru'): admin Email address: [email protected] Password: Password (again): The password is too similar to the username.
I finally got the solution. The problem was with the field's verbose name - it was str instead of unicode. Moving to unicode helped.
Thanks :-)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With