this is the view to the model form that i have created.
def findFault(request):
form = findForm(request.POST or None)
if form.is_valid():
instance = form.save(commit=False)
instance.user = request.user
instance.save()
return redirect("home")
context = {
'form': form,} return render(request, 'findFault.html', context) On Mon, Jan 25, 2021 at 12:43 PM Ernest Thuku <[email protected]> wrote: > Hello kasper, thank you so much for the information. I know how to use the > django forms. The issue was where will I include the python file above. If > I decide to uploadthe excel file and put store it in the django admin, how > will I access its content. I hope its clear now maybe you can help. > > On Mon, Jan 25, 2021 at 12:36 PM Kasper Laudrup <[email protected]> > wrote: > >> Hi Ernest, >> >> On 25/01/2021 10.25, Ernest Thuku wrote: >> > Hello Everyone, >> > I have a python file which I run on the terminal and give me the result >> > that I want. I want to to do the same via a web app whereby instead of >> > interacting with the terminal, I can do that via a browser through a >> > form. I have decided to choose django as the server. Below is the file >> > that I need to integrate to django. It works well in the terminal. I >> > also have the excel file. >> > Now my concern was how can I integrate it with django such that fields >> > like link_name can be filed through a form and when I click a button >> > should give the required results. Thank you fo your time. >> > >> >> Sounds like that should be very simple to do. Have you had a look at how >> Django uses forms: >> >> https://docs.djangoproject.com/en/3.1/topics/forms/ >> >> If you don't have any experience with Django (to be honest, it sounds a >> bit like that) it would probably be a very good idea to start with the >> tutorial: >> >> https://docs.djangoproject.com/en/3.1/intro/tutorial01/ >> >> After you've been through that, you should have a pretty good idea on >> what to do. If you have any problems after that, then share the code >> here and I'm sure someone will help you with the specific problems you >> might face. >> >> Kind regards, >> >> Kasper Laudrup >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/cccd51fe-e2d7-37b6-4439-afe0f0b4a4c7%40stacktrace.dk >> . >> > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAPsfuofjHNF2OcVB%3DMzk2AeHm7VYYGYUhpNJ79pwJjTQmMacaQ%40mail.gmail.com.

