Re: Importing ImageField from file or - better - generating it from another ImageField
Thanks, Bill. I really had a hard time wrapping my head around the ImageField object model. I guess I am now OK, but I had to do more seek(0)'s than I wanted. It's sort of working and properly deduplicating images and thumbnails. I'll check the django-filebrowser product, tidy up what I have done and post it somewhere. On Tue, Jun 1, 2010 at 11:46 AM, Bill Freeman wrote: > Perhaps see the django-filebrowser product. It may have things that > you don't need, but > makes thumbnails, and associates them with an image field, so it is at > least a sample > of what's involved. > > Bill > > 2010/5/31 Ricardo Bánffy : >> Hi folks >> >> I am having huge problems wrapping my head around the ImageField field >> type. I am trying to generate default thumbnails for uploaded images, >> both stored as ImageField attributes. It's done this way because the >> user must be able to manually edit the thumbnail if needed. >> >> I am failing miserably at that. I went as far as to generate the >> thumbnail and saving it to a specific location, but I have so far been >> unable to attribute the contents of that file to the ImageField that >> corresponds to the thumbnail. >> >> Has anyone solved this problem in a simple way? >> >> -- >> Ricardo Bánffy >> http://www.dieblinkenlights.com >> http://twitter.com/rbanffy >> >> -- >> 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. >> >> > > -- > 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. > > -- Ricardo Bánffy http://www.dieblinkenlights.com http://twitter.com/rbanffy -- 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.
Importing ImageField from file or - better - generating it from another ImageField
Hi folks I am having huge problems wrapping my head around the ImageField field type. I am trying to generate default thumbnails for uploaded images, both stored as ImageField attributes. It's done this way because the user must be able to manually edit the thumbnail if needed. I am failing miserably at that. I went as far as to generate the thumbnail and saving it to a specific location, but I have so far been unable to attribute the contents of that file to the ImageField that corresponds to the thumbnail. Has anyone solved this problem in a simple way? -- Ricardo Bánffy http://www.dieblinkenlights.com http://twitter.com/rbanffy -- 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: Image deduplication and upload_to
Thanks. I have successfully made a lobotomized version I called OverwritingStorage that extends FileStorage and overrides get_available_name, _save and delete (and offers a hashed_path classmethod to be used in upload_to callables) http://djangosnippets.org/snippets/2044/ Now my problem is not being able to wrap my head around computing an ImageField based on another ImageField (in my case, a default thumbnail that can be edited later) But that deserves its own thread. On Thu, May 27, 2010 at 6:37 AM, Nuno Maltez wrote: > Hi, > > I think it's designed to do that. See the behaviour of the > save/get_available_name methods on core/files/storage.py (in the > django source). Maybe you can write your own storage that overrides > this (never tried it, but should work). > > Nuno > > 2010/5/26 Ricardo Bánffy : >> Hi folks. >> >> I want to prevent the duplication of uploaded images. For that, I am >> using the upload_to property of ImageField set to a callable that >> computes the md5 hash of the uploaded file data and returns a file >> name. This should work _but_ when I save the model, the filename I >> gave back in the function is getting a "_1", "_2" and so on suffix to >> prevent my efforts at deduplication. >> >> http://dpaste.com/199576/ >> >> Anyone has had a similar problem? >> >> I understand I'll have to take care of other problems too, like >> preventing the deletion of files that are referenced by more than one >> ImageFile and could do something to prevent the actual overwriting of >> the same data on the same file as before, but that's a start. >> >> >> -- >> Ricardo Bánffy >> http://www.dieblinkenlights.com >> http://twitter.com/rbanffy >> >> -- >> 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. >> >> > > -- > 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. > > -- Ricardo Bánffy http://www.dieblinkenlights.com http://twitter.com/rbanffy -- 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.
Image deduplication and upload_to
Hi folks. I want to prevent the duplication of uploaded images. For that, I am using the upload_to property of ImageField set to a callable that computes the md5 hash of the uploaded file data and returns a file name. This should work _but_ when I save the model, the filename I gave back in the function is getting a "_1", "_2" and so on suffix to prevent my efforts at deduplication. http://dpaste.com/199576/ Anyone has had a similar problem? I understand I'll have to take care of other problems too, like preventing the deletion of files that are referenced by more than one ImageFile and could do something to prevent the actual overwriting of the same data on the same file as before, but that's a start. -- Ricardo Bánffy http://www.dieblinkenlights.com http://twitter.com/rbanffy -- 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: Cassandra backend
It would be more on the lines of the first one. I guess folks intent to pretend, as much as possible, that we are running vanilla Django - and, perhaps, deploy to a RDBMS and only move to a non-relational store if the app is successful enough. Thanks! There is a lot to catch up. On Mon, Mar 29, 2010 at 11:43 AM, Daniel Hilton wrote: > 2010/3/29 Ricardo Bánffy : >> Hi. >> >> I am about to be asked to either find a way to use Cassandra as a >> database backend or create one. Is there anyone working on something >> like this? >> > > Do you mean writing a database backend for django ORM that supports Cassandra? > Have a look at the work of non-rel project on BitBucket: > http://bitbucket.org/wkornewald/django-nonrel/wiki/Home > > > Or do you mean using Cassandra in a form with django? > Twissandra as an example: > http://github.com/ericflo/twissandra > > -- Ricardo Bánffy http://www.dieblinkenlights.com http://twitter.com/rbanffy -- 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.
Cassandra backend
Hi. I am about to be asked to either find a way to use Cassandra as a database backend or create one. Is there anyone working on something like this? -- Ricardo Bánffy http://www.dieblinkenlights.com http://twitter.com/rbanffy -- 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: Custom Widget for admin application
But what if I have a ForeignKey or a ManyToManyField in my model? On Fri, Dec 5, 2008 at 12:58 PM, Michel Thadeu Sabchuk <[EMAIL PROTECTED]> wrote: > Pass a grouped list to choices: > > ['group1', [(1, 'item 1'), (2, 'item 2'), ...], ...] --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Custom Widget for admin application
Hi folks. I am looking into Django and the admin framework and I have a couple newbie-ish questions: 1) Is there a sane way to make a custom widget that extends Select and that has its options grouped by in tags according to some criteria? 2) How one does make the built-in admin app to use it? 3) Once decided I will do my own widgets, where is the "right" place to put them? In a widgets.py file within the applciation? -- Ricardo Bánffy http://www.dieblinkenlights.com --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---