How can I make the FileField only available to download for logged in users ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need a different ModelForm (or just Form) if you want to display a different form to the user. This form should look something like this:
This goes inside of the new form that you want to display. Note that you’re extending the other form you were using. This should keep just about everything intact, and you can simply exclude the field you don’t want.
You then need to check if the user is logged in somewhere in your view. That is, something like: