Re: Create a shortcut for raising ValidationError from within the Form.clean() method

2019-09-06 Thread Lucas Weyne
Hi Adam, Your refactor works great and thats how I was thinking to solve this problem. My idea its was use the Meta.error_messages dictionary to solve default error messages. What if I want to raise a ValidationError for a conditional required field and display the default required message *T

Re: Create a shortcut for raising ValidationError from within the Form.clean() method

2019-09-06 Thread Adam Johnson
Hi Lucas, Thank you for writing to the list with your proposal. At first glance, I'm not sure of the value. Shortcuts are nice but they come at the expense of there being two ways to do things. Your example might not best express your idea, but if I were to refactor it to what Django currently s

Create a shortcut for raising ValidationError from within the Form.clean() method

2019-09-06 Thread Lucas Weyne
I want to create a shortcut method to raise ValidationError inside the Form.clean() method. When we need to raise the same ValidationError (same message and same code) many times inside the Form.clean(), I should pass the same message every time. Would be cleaner, pass only the error code and

Re: Project to receive the first 500 bytes of a file coming from client-side before it gets completely downloaded onto the server.

2019-09-06 Thread Adam Johnson
Hi! I think you've found the wrong mailing list for this post. This mailing list is for the development of Django itself, not for support using Django. This means the discussions of bugs and features in Django itself, rather than in your code using it. People on this list are unlikely to answer yo

Re: Project to receive the first 500 bytes of a file coming from client-side before it gets completely downloaded onto the server.

2019-09-06 Thread Sreevardhan Reddy
here is the code if request.method == 'POST': hash = request.FILES['uploaded_file'].read()[:-500] #check if a hash exists in the database On Friday, September 6, 2019 at 5:14:35 PM UTC+5:30, Milind Yadav wrote: > > Hi, > > I am trying to receive the first 500 bytes of a file coming fro

Project to receive the first 500 bytes of a file coming from client-side before it gets completely downloaded onto the server.

2019-09-06 Thread Milind Yadav
Hi, I am trying to receive the first 500 bytes of a file coming from client-side before it gets completely downloaded onto the server. I need to compute the hash value of the first 500 bytes and compare with hashes in database. If no match is found then resume the download i.e. remaining bytes

Re: A post database write signal

2019-09-06 Thread Adam Johnson
Hi Anthony, The idea of some form-related signals has previously been suggested, and there's an open ticket: https://code.djangoproject.com/ticket/27923 and the mailing list thread: https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/django-developers/SviNiWy3Bjc/fqFL8rZvBAAJ

Re: Django-filter customization for rest api

2019-09-06 Thread Adam Johnson
Hi! I think you've found the wrong mailing list for this post. This mailing list is for the development of Django itself, not for support using Django. This means the discussions of bugs and features in Django itself, rather than in your code using it. People on this list are unlikely to answer yo