Answer the question
In order to leave comments, you need to log in
How to auto-complete the servants field when adding a task?
forms
class TaskForm(forms.ModelForm):
class Meta:
model = Task
fields = ('name', 'description', 'category')
def task_new(request):
if request.method == "POST":
form = TaskForm(request.POST)
if form.is_valid():
task = form.save(commit=False)
task.user = request.user
task.created = timezone.now()
task.save()
else:
form = TaskForm()
return render(request, 'post_new.html', locals())
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