Hi,
First post, be gentle :), I cant find a solution here or on StackOverflow, which either means that I am missing something obvious, or the answer is 'you cant', or I am googling for the wrong thing. I am using Django 1.6 on Kubuntu with PIL...
I have a simple UserProfile with an image field (and a Textfield), which uploads the file fine and displays it in the template from MEDIA_URL fine, all working great. I am using the UpdateView generic view to do it and all is dandy, except..
The 'fileupload' form field/widget {{ form.mugshot }} adds some extra HTML to the widget which I would prefer wasn't there:
"Currently: " <a href="path/to/file">path/to/file</a><br/>"Change: "
Is there a way to get rid of that extraneous HTML? It looks ugly and is unnecessary as far as I can see :( but this might not even be Django related.. sorry if I am barking up the wrong tree, but I have lost count of the trees now.. I have found some possible soultions, but some are really complicated and others just dont seem to work for me.
Here is a simplified version of my model and view:
models.py
class UserProfile(models.Model):
user = models.OneToOneField(User, related_name='profile')
about_me = models.TextField(max_length="500")
mugshot = models.ImageField(max_length=1024,storage=OverwriteStorage(), upload_to=image_file_name, default = "images/profiles/anon.user.png")
views.py
class ProfileUpdate(UpdateView):
model = UserProfile
fields = ['mugshot', 'about_me']
template_name_suffix = '_update_form'
Any clues or pointers? Even what to Google for would be good!
Thanks!
Jim