hi folks, I'm using the django app "nesh.thumbnails" for my thumbnails stuff and I got two problems: 1- how can I generate thumbnails for the admin interface using this app, I try this approach:
def admin_thumbnail(self): if self.image: return '{%% load nesh.thumbnails %%} <img src="{{ %s|thumbnail:"width=64,height=64" }}" width="64" height="64" />' % (self.get_image_url(),) return '' admin_thumbnail.short_description = 'Thumbnail' admin_thumbnail.allow_tags = True but it doesn't work, then I try this: def admin_thumbnail(self): from nesh.thumbnails import * if self.image: make_admin_thumbnails(self) return '<img src="%s">' % make_thumbnail(self.get_image_url(), 120) admin_thumbnail.short_description = 'Thumbnail' admin_thumbnail.allow_tags = True it works but this approach got a little problem, when I remove the object from the database, it doesn't delete the admin thumbnails. because the way it rename the thumbnails when you set auto_rename = True. It rename the thumbnails to <class name>-<field name>-<object pk>.<ext> but this is done in the pre_save signal so, when you are going to save an object the first time, it doesn't have the primary key number set yet and this had two implications: 1- If there is any object image in the path you are going to save this image, this new image overwrite the old image. 2- due to the first immplication, if you delete and object with an image, it will delete the image too, but this image is shared across all objects added after the object being deleted. This is true for objects of the same type (model). 2- Is there any way to add templates tags, filters or variables dinamically to the templates of the admin interface, something like this: class TestModel(models.Model): ... def do_something(self): return '{{ "col name"|upper }}' do_something.allow_tags = True ... class Admin: list_display = [...,'do_something'...] -- Lic. José M. Rodriguez Bacallao Cupet ----------------------------------------------------------------- Todos somos muy ignorantes, lo que ocurre es que no todos ignoramos lo mismo. Recuerda: El arca de Noe fue construida por aficionados, el titanic por profesionales ----------------------------------------------------------------- --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---