def form_valid(self, form): ensure_branding_directory_exists() flush_brand_colours(form.cleaned_data) messages.success(self.request, ('Colours updated - changes may take ' 'a few minutes to take effect.')) return super(BrandingManagementUpdateColoursView, self).form_valid(form)
def form_valid(self, form): ensure_branding_directory_exists() dest_name = get_branding_disk_file(self.get_destination_filename()) if os.path.exists(dest_name): delete( os.path.join('kanisa', 'branding', self.get_destination_filename())) with open(dest_name, 'wb') as destination: for chunk in form.files['image'].chunks(): destination.write(chunk) messages.success(self.request, ('Image updated - changes may take ' 'a few minutes to take effect.')) return super(BrandingManagementUpdateView, self).form_valid(form)
def form_valid(self, form): ensure_branding_directory_exists() dest_name = get_branding_disk_file(self.get_destination_filename()) if os.path.exists(dest_name): delete(os.path.join('kanisa', 'branding', self.get_destination_filename())) with open(dest_name, 'wb') as destination: for chunk in form.files['image'].chunks(): destination.write(chunk) messages.success(self.request, ('Image updated - changes may take ' 'a few minutes to take effect.')) return super(BrandingManagementUpdateView, self).form_valid(form)