title: Django add some weird characters at the end of the file
body: <p>I have probelem when I submit the file to the django server and the name of the file exist in a directory. Django do not override the file, but it add some characters to the end of the name. How can I add characters instead of Django.</p>
  
  <p>My model.py looks like this</p>
  
  <pre><code>class UpLoadFile(models.Model):
        user = models.ForeignKey(User, on_delete=models.CASCADE)
        file = models.FileField()
        uploaded_at = models.DateTimeField(default=timezone.now)
  
        def __str__(self):
            return self.file.name + ' (' + self.user.username + ')'
  </code></pre>
  
  <p>views.py looks like this:</p>
  
  <pre><code>@login_required
  def home(request):
      if request.method == 'POST':
  
          if 'upload_file' in request.POST:
              form = UploadFileForm(request.POST, request.FILES)
              form.instance.user = request.user
              if form.is_valid():
                  messages.success(request, 'Datoteka {} je bila uspešno dodana'.format(str(request.FILES["file"])))
                  form.save()
                  return HttpResponseRedirect('/')
  
          else:
              messages.error(request, 'Datoteke {} ni bilo mogoče dodati. Preveriti če datoteka vsebuje podatke.'
                             .format(str(request.FILES["file"])))
              return HttpResponseRedirect('/')
  
  
      elif request.method == 'GET':
          upload_file = UploadFileForm()
          return render(request, 'update_file/home.html', {'page_title': 'Home', 'upload_form': upload_file})
  </code></pre>
  
  <p>forms.py looks like this:</p>
  
  <pre><code>class UploadFileForm(forms.ModelForm):
      file = forms.FileField(required=True)
  
      class Meta:
          model = UpLoadFile
          fields = ('file',)
  </code></pre>