CopyPastor

Detecting plagiarism made easy.

Score: 0.8551145894465635; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2019-04-04
by icyfire

Original Post

Original - Posted on 2015-12-30
by Mike Mahmud



            
Present in both answers; Present only in the new answer; Present only in the old answer;

Django 1.9 added the `Field.disabled` attribute: https://docs.djangoproject.com/en/stable/ref/forms/fields/#disabled
> The disabled boolean argument, when set to True, disables a form field using the disabled HTML attribute so that it won’t be editable by users. Even if a user tampers with the field’s value submitted to the server, it will be ignored in favor of the value from the form’s initial data.
You can do this to disable the fields you want in your view:
@login_required def profile(request): user_form = UserForm(instance=request.user) user_form.fields["<name-of-the-field"].disabled = True return render(request, 'rentadevapp/profile.html', {'user_form': user_form})

Django 1.9 added the Field.disabled attribute: https://docs.djangoproject.com/en/stable/ref/forms/fields/#disabled
> The disabled boolean argument, when set to True, disables a form field using the disabled HTML attribute so that it won’t be editable by users. Even if a user tampers with the field’s value submitted to the server, it will be ignored in favor of the value from the form’s initial data.


        
Present in both answers; Present only in the new answer; Present only in the old answer;