I'd like to implement a functionality in an app of mine, but I don't know how to go about it. What I want is this: I have a model class that uses imagekit to save its images, and I'd like to have the users being able to update the images easily for the vehicles without having to edit each respective vehicle record.
How they'll do this is that there will be a folder containing sub- folders for each vehicle in the format <stock_number>/PUBLIC, then if a user moves images into the PUBLIC folder for a vehicle, when the script is executed, it'll compare those images with the current ones and update them if those in the PUBLIC folder are newer. If the record has no images, then they will be added. Also, if the vehicle's record has images that have been deleted from the site_media directory, then their links should be deleted from the database. How can I go about this in an efficient way? I have no idea on how to go about this so any help would be appreciated. My models are as below: class Photo(ImageModel): name = models.CharField(max_length = 100) original_image = models.ImageField(upload_to = 'photos') num_views = models.PositiveIntegerField(editable = False, default=0) position = models.ForeignKey(PhotoPosition) content_type = models.ForeignKey(ContentType) object_id = models.PositiveIntegerField() content_object = generic.GenericForeignKey('content_type', 'object_id') class IKOptions: spec_module = 'vehicles.specs' cache_dir = 'photos' image_field = 'original_image' save_count_as = 'num_views' class Vehicle(models.Model): objects = VehicleManager() stock_number = models.CharField(max_length=6, blank=False, unique=True) vin = models.CharField(max_length=17, blank=False) .... images = generic.GenericRelation('Photo', blank=True, null=True) Thank you. -- 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.