KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've got a model, with FileField . When I edit this model in a view, I want to change the "current" value of FileField which gets displayed in the view form. Let me explain. models.py: class DemoVar_model(models.Model): ... Welcome_sound=models.FileField(upload_to='files/%Y/%m/%d') forms.py: class DemoVar_addform(ModelForm): ... class Meta: model = DemoVar_model views.py: soundform = DemoVar_addform(instance=ivrobj) .... return render_to_response(template,{'soundform':soundform}, ....) Now I want to edit this model in my view. When I look in browser, I see the form being displayed as Welcome sound: Currently: welcome_files/2011/04/27/15_35_58_ojCompany.wav.mp3 Change : <Choose File button> I want to change this "Currently" value, which describes the whole path of the file as it exits on my server. I want to trim this string to just the filename without the path. How do I accomplish that?
Tags (comma-separated)
Save Edits
Cancel