Answer the question
In order to leave comments, you need to log in
How to pass variables to Django form via jQuery?
have a django form
class Name(forms.ModelForm):
class Meta:
model = Name
fields = ('name', 'surname')
function save() {
var name = 'Monty';
var surname = 'Python';
}
def name(request):
if request.method == "POST":
form = Name(request.POST, request.FILES)
if form.is_valid():
name.save()
else:
print ("Произошла какая-то хрень")
form = NameForm(request.POST)
return render(request, 'site/name.html', {'form': form})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question