recommended method for administrative scripts?
Hello I have just made my first django site for my uncles wedding photos. It is very simple, just photos and tags, with a ManyToMany relationship. I have only made views for viewing the photos and am using the django admin system for uploading and tagging. I am wondering what is the best way to add scripts to do administrative tasks, that dont need to be triggerable by a URL. For example, a decided that the settings i had used to make the thumbnails where to low, and wanted to rerun the thumbnailing on each photo. I did this by making a function in views.py that did the looping through and resizing. Then adding a URL, and visiting it. This seemed like a rather kludgy method. I have a few other tasks that i might want to do. extract the date from the photos EXIF data, and put it in a field in the database (i already have the field). also i think i could save some time if it could scp a bunch of photos to a folder on my server, and add them into the database with a single command. So is there a recommended method of doing this soft of thing? Thanks Sam --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Duplicate files being created on ImageField.save
David Christiansen wrote: > The idea is that image_scaled has a version that is a thumbnail of the > originally updated photo. I've removed that code for testing > purposes, and this still happens. What happens is that two images are > created in content_images/page/PAGE_ID/scaled/, one with an underscore > after the name. image_scaled.path shows that the version with the > extra underscore is the current one referred to after running this. > > This behavior happens on both Windows and Linux servers. I'm running > Django 1.0. As far as I can tell, I'm using the FileField API > correctly. Is there something obvious that I'm missing? > > Thanks in advance! I had a similar issue. The fix i have found on the web is to wrap your action in an if statement to make sure you only do it once Something like def save(self): if not image_scaled: scaled_name = os.path.split(self.image_original.name)[-1] self.image_scaled.save(scaled_name, self.image_original, save=False) super(Page, self).save() --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---