models.py
class UserInfo(models.Model):UID = models.CharField(max_length=50, primary_key=True, default=datetime.now().strftime("%d%y%H%S%m%M")) # default=fullname = models.CharField(max_length=50)mobile = models.CharField(max_length=15)address = models.CharField(max_length=150)city = models.CharField(max_length=30)state = models.ForeignKey(State, blank=False)pincode = models.CharField(max_length=12)occupation = models.CharField(max_length=30, choices=MY_CHOICES)image = models.FileField(upload_to='images/', blank=True, )
Forms.py
class ProfileUpdate(forms.ModelForm): class Meta:model = UserInfofields = ('image', 'fullname', 'mobile', 'occupation', 'address', 'city', 'state', 'pincode')
Views.py
def user_settings(request):email = request.session['email']instance = get_object_or_404(UserInfo, email=email)form = ProfileUpdate(instance=instance)return render(request, 'files/profileSettings.html', {'profileupdate': form, })
Html
<div class="input-field col l7">{{ profileupdate.image }}</div>
My problem is that when I used above html tag for getting choose file for image.this field also shows the path of that file that is already exist.Because I used instance in view that automatic show user value.So I want to hide that location of image.I don't know what I search on google.