Re: Is it possible to change the width of the boxes displayed by the filter_horizontal in Django admin interface?
Walt, Thanks for the clarification. That helped a lot. I did get this working. Yeah! Had to do a slight tweak to the surrounding elements on the page to get it to look right (minor change to widgets.css). Now I can see all of the data for the profiles. Seems like there should be a way to auto scale the width based on data, but that's for another time. Thanks for your help. Reed On Mar 26, 10:43 am, Walt wrote: > I'm sorry I wasn't more clear, the class Media just gets > added to your existing admin class. The path to the css > should be the path that is appended to your SETTINGS.PY > media path to reach the css file. The class ResizeFilterAdmin > was just an example name. > > In other words, if your media path is: /var/www/media > and your css file is stored in /var/www/media/css/bisite.css > then your Media entry would be: > > css = { 'all': ('/media/css/bisite.css',)} > > So the full entry would be: > > class ProfileAdmin(admin.ModelAdmin): > search_fields = ('profile_name',) > ordering = ('profile_name',) > filter_horizontal= ('profile_test',) > > class Media: > css = { > 'all':('/media/css/bisite.css',) > } > > Does that make more sense? Again, I apologize for the > miscommunication! > > Thanks, > Walt > > -~ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Is it possible to change the width of the boxes displayed by the filter_horizontal in Django admin interface?
I'm sorry I wasn't more clear, the class Media just gets added to your existing admin class. The path to the css should be the path that is appended to your SETTINGS.PY media path to reach the css file. The class ResizeFilterAdmin was just an example name. In other words, if your media path is: /var/www/media and your css file is stored in /var/www/media/css/bisite.css then your Media entry would be: css = { 'all': ('/media/css/bisite.css',)} So the full entry would be: class ProfileAdmin(admin.ModelAdmin): search_fields = ('profile_name',) ordering = ('profile_name',) filter_horizontal = ('profile_test',) class Media: css = { 'all':('/media/css/bisite.css',) } Does that make more sense? Again, I apologize for the miscommunication! Thanks, Walt -~ -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Is it possible to change the width of the boxes displayed by the filter_horizontal in Django admin interface?
Walt, Thanks for the response. This is making me crazy. Seems like this should be an easy thing to do. I have tried your suggestion, but I am not totally clear on where in the admin.py It is just not loading up the new media class. Am I supposed to add the resize class as a separate class like this: # class ResizeFilterAdmin(admin.ModelAdmin): class Media: css = { 'all':('bisite.css',) } class ProfileAdmin(admin.ModelAdmin): search_fields = ('profile_name',) ordering = ('profile_name',) filter_horizontal = ('profile_test',) #... or add it into the admin that uses the filter_horizontal like this: class ProfileAdmin(admin.ModelAdmin): search_fields = ('profile_name',) ordering = ('profile_name',) filter_horizontal = ('profile_test',) class ResizeFilterAdmin(admin.ModelAdmin): class Media: css = { 'all':('bisite.css',) } Also, the relative path to the css file? What is that relative to? My admin media so it goes in the same directory as the other admin css files, or relative to my application directory. I appologize for the basic questions. I am just having a hard time grasping the admin modification stuff. On Mar 23, 9:22 am, Walt wrote: > You'll need add a stylesheet Media class to your admin class: > > class ResizeFilterAdmin(admin.ModelAdmin): > # > > class Media: > css = { 'all': ('/relative/path/to/supplemental.css'), } > > Then, in that CSS file you'll need to specify the width of your > element: > > /* by class */ > .filtered { > width: 350px; > > } > > /* or by object id */ > #id_yourfieldname_from { > width: 350px; > > } > > #id_yourfieldname_to { > width: 350px; > > } > > This should work. :-) > > Walt -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Is it possible to change the width of the boxes displayed by the filter_horizontal in Django admin interface?
You'll need add a stylesheet Media class to your admin class: class ResizeFilterAdmin(admin.ModelAdmin): # class Media: css = { 'all': ('/relative/path/to/supplemental.css'), } Then, in that CSS file you'll need to specify the width of your element: /* by class */ .filtered { width: 350px; } /* or by object id */ #id_yourfieldname_from { width: 350px; } #id_yourfieldname_to { width: 350px; } This should work. :-) Walt -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Is it possible to change the width of the boxes displayed by the filter_horizontal in Django admin interface?
I am using the filter_horizontal in my Django admin interface and it works great. Only problem is that some of the data that is contained in the manytomany relationship is longer than the filter_horizontal forms in the admin interface. How do I change the _width_ of the forms displayed. >From looking at the page source it is using a class called _filtered_. From what I can tell that is generated from the contrib/ admin/media/js/SelectFilter2.js, but I don't really understand where the size is set. I was also able to modify the div elements that surround the actual filter_horizontal data by editing the widgets.css, but could not find where the actual _size_ of the filter_horizontal element is controlled. I guessing that I am making this to hard. Does anyone know how to do this? I was hoping it was as easy as adding some meta tags to the actual filter_horizontal line in my admin.py file, but could not find much information on filter_horizontal other than how to use it. Any help is greatly appreciated. rc -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.