Giter VIP home page Giter VIP logo

Comments (10)

sebhaase avatar sebhaase commented on August 18, 2024 1

from django-file-form.

mbraak avatar mbraak commented on August 18, 2024

I'll check if the upload to the temp folder can be prevented.

About the permissions: one solution is to disable uploads. Would that be a solution? I think it's not possible at this moment to disable uploads. I'll check that.

from django-file-form.

mbraak avatar mbraak commented on August 18, 2024

A possible solution is to make the field disabled when the user doesn't have the permission to upload. Pr #680 adds support for disabled fields.

Another solution is to hide the field.

from django-file-form.

sebhaase avatar sebhaase commented on August 18, 2024

from django-file-form.

mbraak avatar mbraak commented on August 18, 2024

I'll check if it's possible to display an error message.

It's a good idea to check as early as possible if a user has permission to upload; the easiest solution is to make the check_permission function configurable.

In the settings file:

def custom_check_permission(request):
  if not request.user.is_authenticated:
    raise PermissionDenied()

FILE_FORM_CHECK_PERMISSIONS_FUNCTION = custom_check_permission

Would that work in your situation?

from django-file-form.

sebhaase avatar sebhaase commented on August 18, 2024

from django-file-form.

sebhaase avatar sebhaase commented on August 18, 2024

I have another issue: to really determine if the upload should be allowed, I would need to get values from other fields of the form... I don't see how that would be at all possible...
So, guess that part comes down to the question of how to delete temp uploads on failed (or never triggered) save...

from django-file-form.

mbraak avatar mbraak commented on August 18, 2024

The form has a delete_temporary_files method that removes all temporary files. So that's in the right direction.

I can have a look later if it's possible to remove files for a single field.

from django-file-form.

mbraak avatar mbraak commented on August 18, 2024

I added the method delete_temporary_files_for_field in pr #689.

from django-file-form.

mbraak avatar mbraak commented on August 18, 2024

Does pr #689 fix the issue?

from django-file-form.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.